Thief
2013-05-01 09:27:07
I'm trying to use a simple wait function while my character climbs an obstacle, so he doesn't try and go onto the next procedure.
The annoying thing is, sometimes it works and sometimes it ignores the wait completely, and I have no idea why :duh:
The wait is right at the end of the code.
The annoying thing is, sometimes it works and sometimes it ignores the wait completely, and I have no idea why :duh:
The wait is right at the end of the code.
Function FindShortcut:boolean;
var
PathTPA, WallTPA:TPointArray;
PathATPA:T2DPointArray;
PathBox:TBox;
i, r, counter:integer;
begin
if not(loggedin) then
exit;
Wait(RandomRange(2000, 200));
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.13, 0.43);
if FindColorsSpiralTolerance(MSX1, MSY1, PathTPA, 4413280, MSX1, MSY1, MSX2, MSY2, 20) then
begin
PathATPA := SplitTPAEx(PathTPA, 25, 25);
SortATPASize(PathATPA, True);
for i := 0 to high(PathATPA) do
begin
PathBox := GetTPABounds(PathATPA[i]);
SetColorSpeed2Modifiers(0.20, 3.85);
if FindColorsSpiralTolerance(MSX1, MSY1, WallTPA, 12118515, PathBox.X1, Pathbox.Y1, Pathbox.X2, Pathbox.Y2, 10) then
Break;
if i = high(PathATPA) then
begin
writeln('Couldnt find wall color');
Terminatescript;
end;
end;
SetColorToleranceSpeed(1);
SetColorSpeed2Modifiers(0.2, 0.2);
marktime(counter);
while (not isuptext('wall')) do
begin
r := random(length(WallTPA));
mmouse(WallTPA[r].x, WallTPA[r].y, 2, 2);
wait(randomrange(200, 500));
if timefrommark(counter) > 10000 then
begin
writeln('couldnt find it');
Logout;
Terminatescript;
end;
end;
ClickMouse2(Mouse_left);
end;
Wait(RandomRange(7000, 1000)); [COLOR="#0000FF"]//This is my wait...... :([/COLOR]
end;