Which TPA is best?
Simba Code:
Function FindTrees(Var X, Y : Integer; W, H, X1, Y1, X2, Y2 : Integer): Boolean;
Begin
var
x, y, i, h : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
begin
if not LoggedIn then Exit;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.17, 1.87);
begin
FindColorsSpiralTolerance(x, y, TPA, 2904128, MSX1, MSY1, MSX2, MSY2, 6);
SetColorToleranceSpeed(1);
ATPA := SplitTPAEx(TPA, 4, 4);
if (Length(ATPA) = 0) then
Exit;.
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
h := High(ATPA);
for i := 0 to h do
begin;
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 3, 3);
WaitUpText('illo', 250);
end else
Exit;
end;
Writeln('Found the Willow!');
end;
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(1);
Result := Players[CurrentPlayer].Loc := 'found trees';
End;
Simba Code:
program FindObject;
{.include SRL\SRL.scar}
var
x, y: Integer;
function FindObject(var fx, fy: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.17, 1.87);
if not(FindColorsTolerance(arP, 2904128, MSX1, MSY1, MSX2, MSY2, 6)) then
begin
Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 3.31) and (X <= 8.16) and (Y >= 4.21) and (Y <= 10.91) and (Z >= 1.91) and (Z <= 5.93) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;
SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 10, 10);
arL := High(ararP);
for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if (IsUpText('Take')) then
begin;
Result := True;
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
begin
Writeln('FindObject could not find object.');
Exit;
end;
GetMousePos(fx, fy);
end;
begin
SetupSRL;
FindObject(x, y);
end.
Thankyoooo
-Boom