A couple things I noticed. First off, 'IntToBox' has the parameters in this order: X1, Y1, X2, Y2. You have:
Simba Code:
TPAYou := TPAFromBox(IntToBox(205, 263, 291, 250));
According to this your box's Y1 is > than the Y2 value... So... are you sure that's correct? :/
Another thing is you're actually never removing the 'box area' around your player from your found colour's TPA. You should do this instead:
Simba Code:
program new;
{$i SRL/srl.simba}
function FindSomething: Boolean;
var
CTS, x, y, I, h: Integer;
TPAYou, TPA: TPointArray;
ATPA: array of TPointArray;
CPA: T2DPointArray;
mid: TPoint;
begin
TPAYou := TPAFromBox(IntToBox(205, 263, 291, 250)); //You'll want to fix these parameters in the X1,Y1,X2,Y2 format
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(3.49, 5.27);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 3041353, MSX1, MSY1, MSX2, MSY2, 7);
SetColorSpeed2Modifiers(0.2, 0.2); //Also added this in
ColorToleranceSpeed(CTS);
TPA := ClearTPAFromTPA(TPA, TPAYou); //Here's where you actually remove any of the TPA that's included in your box
ATPA := TPAToATPAEx(TPA, 25, 25);
for I := 0 to High(ATPA) do
begin
CPA := SplitTPA(TPA, 0); //Why? :/
h := High(CPA);
for i := 0 to h do
begin
if (GetArrayLength(CPA[i]) >= 2) then
begin
mid := MiddleTPA(CPA[i]);
if ((mid.x > 5) and (mid.y > 2)) then
begin
if ((not PointInTPA(mid, TPAYou))) then
begin
MMouse(mid.x, mid.y, 0, 0);
begin
MiddleTPAEx(ATPA[i], x, y);
Mouse(x, y, 2, 2, False);
if (ChooseOption('ttack')) then
begin
Wait(1000);
Result := True;
Exit;
end;
end;
end;
end;
end;
end;
end;
Result := False;
end;
begin
SetupSRL;
FindSomething;
end.
I used Simba's handy little 'Format Script' button to clean up your code.