Your function currently returns a boolean..
make it return a TPointArray..
Then do something like:
Simba Code:
function TrackNPC(hue, saturation: double; Color, Tol : Integer; Uptext : TStringArray; XBounds, YBounds, Tries : Integer): TPointArray;
var
I, N, x, y, t: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
FoundIt: Boolean;
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(h, s);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, Color, MSX1, MSY1, MSX2, MSY2, Tol);
ATPA := TPAToATPAEx(TPA, 15, 15);
N := High(ATPA);
for I := 0 to N do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 2, 2);
if(IsUpTextMultiCustom([Uptext])) then
begin
FoundIt := True;
GetMousePosition(x, y);
end;
end;
while(FoundIt = true) do
for t := 0 to Tries do
if FindColorsSpiralTolerance(x, y, TPA, Color, (x - (XBounds/2)) , (y - (YBounds/2)), (x + (XBounds/2)), (y + (XBounds/2)), Tol) then
begin
ATPA := TPAToATPAEx(TPA, 15, 15);
MiddleTPAEx(ATPA[i], x, y);
writeln('Object is currently at ' + IntToStr(x)+ ',' + IntToStr(y));
SetLength(Result, Length(Result) + 1);
Result[I]:= Point(X, Y);
break; // Found object
FoundIt := true;
end
else begin
writeln('Failed to find object - Trying again');
Inc(t);
FoundIt := False;
end;
wait(100 + Random(100));
end;