
Originally Posted by
pure_thief
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
The wait is right at the end of the code.
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)); //This is my wait...... :(
end;
try this out it will wait untill your not moving and not climbing an obstacle
Simba Code:
Function FindShortcut:boolean;
var
PathTPA, WallTPA:TPointArray;
PathATPA:T2DPointArray;
PathBox:TBox;
i, r, counter:integer;
Pbox: Tbox
begin
if not(loggedin) then
exit;
PBox := IntToBox(206, 137, 309, 230);
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;
while (isMoving) do
wait(50);
while (AveragePixelShift(PBox, 250, 500) > 300) do
wait(150);
end;