Need help from those in the know
Today while writing this I've had a crash course in text and the multiple ways in which Simba handles it. There were a few versions of the code above using varying methods but this was the simplest, most reliable and most importantly low on the CPU usage (considering how often a function to check for loot will be called).
The function of choice was FindTextTPAinTPA. Now it appears this function is supposed to return a TPA of every matched point between SearchTPA and TotalTPA in the Matches param but it only matches the first index of the SearchTPA. Another very similar function FindTPAinTPA also has this same issue. The first point is enough to have the script work, but an entire match will improve accuracy to near 100% so long as the text is readable.
I've pulled the function from source and played around with it a bit but I'm getting the same issue. It seems to perform a very odd way of matching, inverting the TPA (not the same points in reversed order, instead every point except the ones in the original TPA) and looking for non-matches as a way of matching. Although weird (I'm sure there's a reason I'm not currently foreseeing that explains it) the code looks like it should do as the params suggest and return an entire TPA of matched points.
Any help with that is appreciated.
Also a small issue with FindTPAinTPA: The function preview in Simba states that both SearchTPA AND TotalTPA will be passed as const, but after having my local SearchTPA augmented after passing to the function I looked at the source and only TotalTPA is const, SearchTPA while not passed by ref is changed within the function and those changes carry over back to the script.
The following code highlights both issues mentioned:
Simba Code:
var
FirstTPA, SecondTPA, ThirdTPA: TPointArray;
begin
FirstTPA := [ Point(10,10), Point(10,11), Point(10,12), Point(11,12), Point(12,12) ];
SecondTPA := [ Point(11,11), Point(11,12), Point(11,13), Point(12,13), Point(13,13)];
Writeln('First: ', FirstTPA);
Writeln('Secon: ', SecondTPA);
FindTPAinTPA(FirstTPA, SecondTPA, ThirdTPA);
Writeln('First: ', FirstTPA);
Writeln('Secon: ', SecondTPA);
Writeln('Third: ', ThirdTPA);
end.
Code:
First: [{X = 10, Y = 10}, {X = 10, Y = 11}, {X = 10, Y = 12}, {X = 11, Y = 12}, {X = 12, Y = 12}]
Secon: [{X = 11, Y = 11}, {X = 11, Y = 12}, {X = 11, Y = 13}, {X = 12, Y = 13}, {X = 13, Y = 13}]
First: [{X = 0, Y = 0}, {X = 0, Y = 1}, {X = 0, Y = 2}, {X = 1, Y = 2}, {X = 2, Y = 2}]
Secon: [{X = 11, Y = 11}, {X = 11, Y = 12}, {X = 11, Y = 13}, {X = 12, Y = 13}, {X = 13, Y = 13}]
Third: [{X = 11, Y = 11}]
As you can see, FirstTPA has now been changed. ThirdTPA which should contain all points from SecondTPA as they all match with FirstTPA, only holds the first matched index.
I know double posting is frowned upon but I didn't want this clogging up the bottom of the OP and being skipped over.