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...
Simba Code: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[i] 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!