SRL Archive - RS3 Help

TBox to ATPA?


Brotein

2014-09-04 11:51:49

This might seem a little weird but I want to convert an array of TBoxes to an array of TPAs.

Normally I would just use TPA.toATPA() but the colors aren't unique in the area and it creates issues when splitting the box since the objects closer to the camera and larger than those further. However a grid of TBoxes is consistent and seems the best way to search. So I thought of something, and I could be wrong but try to follow my logic(it's early so I could be doing something far more difficult than needed).

My objects are in a fixed grid, and I have 12 TBoxes to search for the colors inside of. So here's my logic behind the steps…

fucntion clickThings() : Boolean;
begin
for i:=0 to 11 do
begin
if color in tbox[i] then
create tpa from tbox[i];
end;
add tpa to atpa;
sort atpa by distance;
click on x,y;
end;

This is just rough code but the steps are:
1)Search for color in each of our 12 TBoxes(as a TBox Array)
2)If color exists in box(maybe do a color count) then create TPA for that box
3)Add TPAs to ATPA
4)Sort ATPA by distance
5)Click on ATPA if uptext is correct

My only thing I don't see in the documentation is how to add multiple TPAs to the index of an ATPA.

Like I said splitATPA just doesn't work for this situation(it does but the colors do get screwy and make it unreiable). This grid of TBoxes is 100% accurate and doesn't change in the game world.

So 2 questions, how to I combine my TPAs(12 separate ones in this case into an ATPA). Or could I limit the search area for my color search to make a TPA and then splitATPA to the array of TBoxes? Other question, if there's an easier method or one that makes more sense please share. Thanks!

riwu

2014-09-04 12:02:45

I'm not entirely clear what you are trying to do, but u can use TPAFromBox() to get tpa from a box, and for 'combine my TPAs(12 separate ones in this case into an ATPA)'

SetLength(atpa, length(boxes));
for i:=0 to high(boxes) do
FindColors(atpa[i], ... boxes[i]);
tpa := MergeATPA(atpa);

Camel

2014-09-04 12:10:54

I really don't think there is reason to convert the Tboxes to an ATPA other then to sort it from distance. You could just have your original array of tboxes sorted by distance, then resort it based on if it has the color in it or not.

Brotein

2014-09-04 12:43:36

From: riwu
I'm not entirely clear what you are trying to do, but u can use TPAFromBox() to get tpa from a box, and for 'combine my TPAs(12 separate ones in this case into an ATPA)'

SetLength(atpa, length(boxes));
for i:=0 to high(boxes) do
FindColors(atpa[i], ... boxes[i]);
tpa := MergeATPA(atpa);


Thanks was trying to figure out what function to use, that did the trick.