I'm making a Chicken Finder that uses TPA's but I need help because when it Finds all the objects the script will mouse over a "object" (could be a chicken) and check for text but I want it to check objects random not just the nearest first.
I came up with two solutions:
1 - To make an array of Booleans, the same size of the TPointArray which stores if the objects have been checked yet and for randomly getting a Point I just use Random(<Blah Blah>); and it checks if the point has already been checked if so then it will try again until it actually gets one that isn't and once the whole array of Booleans are true then we break from the loop or whatever has to be done. But time is wasted calling Random(<Blah Blah>); and for all I know it could call same number 100000 times which is highly unlikely but...still.
2 - To "pre-randomize" the calling of the array, but I have no idea, I've stopped here because I need someone to fill in the space 
but if that can happen then it means I don't need to use solution one and this one would be much faster.
Anybody who wants to see the unfinished function:
SCAR Code:
function FindAndClickChicken: Boolean;
var
GetPoints, ChickenTPoint, Chickens: TPointArray;
ObjectPoints: T2DPointArray;
ObjectCords: TPoint;
SpeedSwitch, FastLength: Integer;
begin
repeat
SwitchSpeed := GetColorToleranceSpeed;
if (SwitchSpeed <> 2) then
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.14);
if FindColorsTolerance(GetPoints, 990082, MSX1, MSY1, MSX2, MSY2, 11) then
begin
ObjectPoints := SplitTPA(GetPoints, 10);
FastLength := High(ChickenPoints);
SetColorSpeed2Modifiers(0.07, 0.94);
for I := 0 to FastLength do
begin
try
ObjectCords := MiddleTPA(ObjectPoints[I]);
except
begin
Writeln('Warning: Could not find Middle point of TPA, runtime error avoided. Using first point.');
ObjectCords := ObjectPoints[I][0];
end;
if FindColorsTolerance(ChickenTPoint, 4357017, ObjectCords.X - 5, ObjectCords.Y - 5, ObjectCords.X - 20, ObjectCords.Y - 20, 22) then
begin
try
ObjectCords := MiddleTPA(ObjectPoints[I]);
except
begin
Writeln('Warning: Could not find Middle point of TPA, runtime error avoided. Using first point.');
ObjectCords := ChickenTPoint[0];
end;
SetArrayLength(Chickens, Length(Chickens) + 1);
try
Chickens[High(Chickens)] := ObjectCords;
except
begin
Writeln('Warning: Could not assign ObjectCords to Chickens array, runtime error avoided.');
Writeln('This is a weird error and a very serious one, please post this error with your progress report.');
SetArrayLength(Chickens, Length(Chickens) - 1);
ErrorTPointChickens := True;
end;
end;
end;
if (Length(Chickens) < 1) then
Continue;
FastLength := High(Chickens);
for I := 0 to FastLength do
begin
end;
end;
until()
end;
begin
end.
Suggestions are welcome, but please keep in mind this code hasn't been tested and is a "rough sketch".