Simba Code:
function CTS2Template: boolean;
var i, tcts: integer;
p: TPoint;
tpa, tpa2: TPointArray;
atpa: T2DPointArray;
begin
Result:=False;
tcts:=GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.2, 0.2);
FindColorsTolerance(tpa, 3819595, MSX1, MSY1, MSX2, MSY2, 5);
SetColorToleranceSpeed(2);
if length(tpa) < 1 then Exit;
atpa:= TPAtoATPAEx(tpa, 20, 10);
if length(atpa) < 1 then Exit;
setLength(tpa2, length(atpa));
for i:=0 to high(tpa2) do
tpa2[i]:= MiddleTPA(atpa[i]);
SortTPAFrom(tpa2, Point(MSCX, MSCY)); //this does the trick
{$IFDEF DEBUG_DRAW}
// SortATPAFrom(atpa, Point(MSCX, MSCY));
debugATPABounds(atpa);
{$ENDIF}
for i:=0 to high(tpa2) do
begin
Mouse(tpa2[i].x, tpa2[i].y, 2, 2, mouse_move);
if WaitUpText('nter', 1000) then
begin
ClickMouse2(mouse_left);
Result:=WaitFunc(@BankScreen, 200, 2000); //maybe pin screen too?
if Result then
begin
writeln('We''re in bank screen!');
break;
end;
end;
end;
end;