So i have a script that takes a tpa, splits them up into groups using an ATPA. Now I need to take x groups and group them back into a separate TPA all together. How can this be done?
So i have a script that takes a tpa, splits them up into groups using an ATPA. Now I need to take x groups and group them back into a separate TPA all together. How can this be done?
-Aspect Abyss-https://villavu.com/forum/showthread.php?t=117559
-WaterfallQuest Runner- https://villavu.com/forum/showthread.php?t=116562-GiantRat Slayer- https://villavu.com/forum/showthread.php?t=116523
I pretty much need to take a cluster of 3 tpas, and make them one group.
-Aspect Abyss-https://villavu.com/forum/showthread.php?t=117559
-WaterfallQuest Runner- https://villavu.com/forum/showthread.php?t=116562-GiantRat Slayer- https://villavu.com/forum/showthread.php?t=116523
Look at CombineTPA and AppendTPA.
Simba Code:var
groupA, groupB, groupC, largeGroup: TPointArray;
Groups: T2DPointArray;
i: Integer;
begin
groupA := [Point(5,5),Point(6,6),Point(7,7)];
groupB := [Point(9,9),Point(10,10),Point(11,11)];
groupC := [Point(13,13),Point(14,14),Point(15,15)];
Groups := [groupA, groupB, groupC];
for i := 0 to High(Groups) do
AppendTPA(largeGroup, Groups[i]);
Writeln(largeGroup);
end.
OSRS Color Scripts: Borland_Salamanders | Borland_Iron_Ores
Utilities & Snippets: [Color] OSBuddy Item Looting
So say the three groups are on three different edges of the screen. Once you combine them, and then get the midpoint of the tpa, would it be in the middle of the three groups? That's the goal.
-Aspect Abyss-https://villavu.com/forum/showthread.php?t=117559
-WaterfallQuest Runner- https://villavu.com/forum/showthread.php?t=116562-GiantRat Slayer- https://villavu.com/forum/showthread.php?t=116523
-Aspect Abyss-https://villavu.com/forum/showthread.php?t=117559
-WaterfallQuest Runner- https://villavu.com/forum/showthread.php?t=116562-GiantRat Slayer- https://villavu.com/forum/showthread.php?t=116523
Though I do not believe it is the answer to your question, what your title is describing is called a 3-dimensional array.
A TPA is a TPointArray. Therefore, "Array of array of TPA's" can be represented as: TPoint[][][]
This can be implemented like so:
Simba Code:type TPointArray3D = array of array of TPointArray;
Or skipping the TPA typdef entirely:
Simba Code:type TPointArray3D = array of array of array of TPoint;
And can be utilized like so:
Simba Code:var
theArray: TPointArray3D;
theArray[firstColumn][secondColumn][thirdColumn] := Point(0, 0);
An array stores a collection of values.
A 2D array stores a collection of arrays.
A 3D array stores a collection of 2D arrays.
You choose which one to use depending on how many dimensions of data you need to represent, hence the name, dimensional arrays.
Now did you mean something else? From your description it sounds more like you need a 2D array.
-Aspect Abyss-https://villavu.com/forum/showthread.php?t=117559
-WaterfallQuest Runner- https://villavu.com/forum/showthread.php?t=116562-GiantRat Slayer- https://villavu.com/forum/showthread.php?t=116523
In that case, to add onto the last post;
Adding a point to a TPointArray3D:
Simba Code:theArray[firstColumn][secondColumn][thirdColumn] = Point(0, 0);
Adding a TPA to a TPointArray3D:
Simba Code:theArray[firstColumn][secondColumn] = theTPA;
Adding an array of TPA (ATPA?) to a TPointArray3D:
Simba Code:theArray[firstColumn] = theATPA;
So to group 3 ATPA objects:
Simba Code:var
theArray: TPointArray3D;
theArray[0] = atpa1;
theArray[1] = atpa2;
theArray[2] = atpa3;
Not with the two functions I know for getting the middle of a TPA.
MiddleTPA produces an average point.
From my understanding of your post, you'd want a point of 150,150 to be returned. But this function returns 150,133 because there are two y values with 100 and only one at 200.Simba Code:Writeln(MiddleTPA([[100,100],[200,100],[150,200]]));
Using AeroLibs TPointArray.midPnt will produce even funkier results as the function finds the middle of the TPA using the function above, but then it'll return the closest actual point in the TPA to the middle point it got. In normal use this is often desirable to make sure you're clicking a point that was actually found and not some void area in between. For your uses though, not so useful.
There's probably a function for finding the middle of a triangle in this way. If there isn't, luckily it's fairly easy.
Edit: If 150,150 isn't what you'd want from the above then MiddleTPA, fed with a TPA of 3 points, which are the mid points of your 3 TPAs, will work fine.
OSRS Color Scripts: Borland_Salamanders | Borland_Iron_Ores
Utilities & Snippets: [Color] OSBuddy Item Looting
There are currently 1 users browsing this thread. (0 members and 1 guests)