SCAR Code:
{*******************************************************************************
function CloseWindow: Boolean;
By: NaumanAkhlaQ, Narcle, and Nava2
Description: Closes any open windows.
*******************************************************************************}
function CloseWindow: Boolean;
var
Col: TIntegerArray;
b: T2DPointArray;
a: T2DPointArray;
Pa: TBox;
I, ii, {h,} l: Integer;
begin
Result := CloseBank;
Col := [1118997, 1449250, {Main typ 1}
7976927, 4095140, {Skill}
6854059, 2902100, {Quest}
4282212, 2503226, {Main typ 2}
39423, 13567, {Red X}
1514271, 1580837, {Deposit Box}
1383457, 2107437];
SetLength(b, 2);
for I := 0 to 6 do
begin
FindColors(b[0], Col[i*2], MSCX, MSY1, MSX2, MSCY);
FindColors(b[1], Col[i*2+1], MSCX, MSY1, MSX2, MSCY);
l := (High(b[0]) + High(b[1]));
//Writeln(IntToStr(i) + ' Col1: ' + IntToStr(High(b[0])) + ' Col2: ' + IntToStr(High(b[1])) + ' T: ' + IntToStr(l));
if InRange(l, 6, 53) or InRange(l, 94, 250) then
begin
a := SplitTPA(CombineTPA(b[0], b[1]), 5);
SortATPAFromFirstPoint(a, Point(507, 14));
//DebugATPA(a, '');
for ii := 0 to 0 do
begin
Pa := GetTPABounds(a[ii]);
if ((Pa.x2 - Pa.x1) > 50) or ((Pa.y2 - Pa.y1) > 50) then Continue;
MMouse(RandomRange(Pa.x1, Pa.x2), RandomRange(Pa.y1, Pa.y2), 0, 0);
Result := (Pos('lose', GetUpText) > 0) or (Pos('ack', GetUpText) > 0);
Pa.x2 := GetTimeRunning + 2000;
while (not Result) and (GetTimeRunning < Pa.x2) do
begin
Wait(10);
Result := (Pos('lose', GetUpText) > 0);
end;
Wait(Random(300));
if Result then
begin
GetMousePos(Pa.x1, Pa.y1);
Mouse(Pa.x1, Pa.y1, 0, 0, True);
Result := True;
//Writeln('Close Window Type ' + IntToStr(i));
Exit;
end;
end;
end;
end;
end;