SCAR Code:
function NearestObjMT(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; Tolerance: Integer): Boolean;
var
TPA: TPointArray;
O: Integer;
Start : Boolean;
x, y, a, b, c, i, x1, y1, x2, y2 : Integer;
begin
if (not(LoggedIn)) then
Exit;
for b := 0 to (GetArrayLength(Color)-1) do
begin
if FindColorsTolerance(TPA, Color[b], MSX1, MSY1, MSX2, MSY2, tolerance) or ScanMMAreaColorExactTolerance(x, y, MSX1, MSY1, MSX2, MSY2, Color[b], tolerance) or ScanMMAreaColorExactTolerance(x, y, MSX1, MSY1, MSX2, MSY2, Color[b],tolerance) then
begin
Start := True;
Break;
end;
end;
if(Start)then
begin
x1 := 245;
y1 := 165;
x2 := 277;
y2 := 185;
repeat
if (not (Loggedin)) then
break;
a := a + 1;
if (a = 1) then
c := c + 1;
if (a = 3) then
c := c + 1;
for i := 1 to c do
begin
if (a = 1) then
begin
x1 := x1 + 21;
x2 := x2 + 21;
end;
if (a = 2) then
begin
y1 := y1 - 14;
y2 := y2 - 14;
end;
if (a = 3) then
begin
x1 := x1 - 21;
x2 := x2 - 21;
end;
if (a = 4) then
begin
y1 := y1 + 14;
y2 := y2 + 14;
end;
if (x1 = 485) and (x2 = 517) then
x2 := x2 - 2;
if (y1 = 325) and (y2 = 345) then
y2 := y2 - 7;
if (x2 > 515) then
Break;
for b := 0 to (GetArrayLength(Color)-1) do
begin
if FindColorsTolerance(TPA, Color[b], MSX1, MSY1, MSX2, MSY2, tolerance) or (FindColorTolerance(x, y, Color[b], x1, y1, x2, y2, tolerance)) or (FindColorTolerance(x, y, Color[b], x1, y1, x2, y2, tolerance)) then
begin
For O := 0 To High(TPA) Do
Begin
MMouse(TPA[O].x, TPA[O].y,0,0);
cx:=x;cy:=y;
if IsUptextMultiCustom(Text) then
begin
Result := True;
Break;
end;
end;
end;
end;
end;
if (a = 4) then
a := 0;
until (x2 > 515) or (Result = True);
end;
end;