
Originally Posted by
JJordan
How would I cycle through a T2DPointArray using a for loop ofc, I can't find a size function in the docs.
Also for each TPA in the array I need to search through a list of colors/ATPA's and find the closest one to the original ATPA.
Not sure if this make sense.
I'm trying to identify siphoning nodes in runespan.
For the first question, if I understand correctly:
Simba Code:
ATPA : T2DPointArray;
i : Integer;
//...
for i := 0 to high(ATPA) do
begin
ATPA[i].anyFunction //ATPA[i] will give you the i(th) index of the ATPA, meaning you are working with a TPA and can use any TPA functions you want
end;
For the second one, I assume you mean "close" as in distance because of the title of the thread. For that, you should use a sorting function. There are many (look through the Simba docs to see them) but here's an example of one. I'm not sure what you mean by "the TPA closest to the ATPA" because all TPAs are inside of the bounds of the ATPA so there's not really a "closest" when they're all inside.
Simba Code:
ATPA.sortFromMidPoint(mainScreen.getCenterPoint());
So that sorts all the TPAs in the ATPA based on the center of the mainscreen. Then ATPA[0] would be closest to the center of the screen. You just need to figure out what point you're sorting from, because you're kinda vague about that.