For no reason that I can find, when I run this script the smart client will completely freeze or blackscreen and after maybe 10-15 seconds put me at the login screen. I've isolated the problem to this procedure...
SCAR Code:
procedure FindFountain;
Var
Full : Integer;
Empty : Integer;
WaitTime : Integer;
x1, y2 : Integer;
FountTPA : TPointArray;
FountPoint : TPoint;
i : integer;
Ax, Ay : Integer;
Begin
Flag;
wait(700);
Flag;
FindColorsTolerance(FountTPA, 14066312, MSX1, MSY1, MSX2, MSY2, 90);
if Length(FountTPA) = 0 then
begin
WriteLn('Couldn''t find FountTPA');
exit;
end;
for i := 0 to High(FountTPA)do
Begin
FountPoint := FountTPA[Random(Length(FountTPA))];
Full := DTMFromString('78DA63DCCEC4C0B09F9101192C5B7998811F4' +
'88344FF0301E361A09A7DA86A20B2301248EF03AAD94A40CD4EA0' +
'9A5504D46C05AAD94940CD36A09A6304D4EC27AC060007921083');
Empty := DTMFromString('78DA63BCC1C0C060C1C8800CCACA2B18F8813' +
'448F43F10303E0032CC51D540646124907E0C241C08A8B948849A' +
'EB40C285809A2B40C214BF1A0026970C07');
if(FindDTM(Empty, x1, y2, MIX1, MIY1, MIX2, MIY2))then
begin
Mouse(x1, y2, 5, 5, true);
Mouse(FountPoint.x, FountPoint.y, 5, 5, true);
WaitTime := 0;
repeat
Inc(waitTime);
if(WaitTime = 30) then
begin
WriteLn('Search got wrong coords or lost? Breaking Loop...');
break;
end;
Wait(1000);
AntiBan;
AntiRandom;
until not(FindDTM(Empty, Ax, Ay, MIX1, MIY1, MIX2, MIY2))
end;
end;
FreeDTM(Full);
FreeDTM(Empty);
end;
Neither the 'search got wrong coords or lost' nor 'couldn't find FountTPA' lines come up in the debug box when it crashes and the crash always happens after the tpoint has been found and clicked on. The repeat until loop actually runs smooth until there are no empty DTMS left on the screen. I think its something with the until not(FindDTM(Empty, Ax, Ay, MIX1, MIY1, MIX2, MIY2)) that makes it crash but i'm not sure. I made sure the DTM is correct (plus it uses the same dtm successfully only 10 or so lines up...i'm puzzled...
edit:
i took out every element of the script one by one where the error occurs (and replaced until not(finddtm(empty) with until(false) and i still get the error, I'm truly confused. HELP D: