Try using a label instead of calling the same procedure again within a procedure. (makes it repeat it)
Simba Code:
procedure LeavingBalancingLedgeRoomLadder;
var
x, y : integer;
aFound : extended;
label DoItAgain; // Declaring our label, like a var.
begin
DoItAgain: //Makes it jump to here again :)
MakeCompass('S');
SetAngle(SRL_ANGLE_HIGH);
Wait(1500);
if FindColorSpiralTolerance( x, y, LedgeLadder, 190, 87, 339, 185, 5) then
// If finds Ladder
begin
MoveMouse( x, y);
end else
begin
WriteLn('Failed to Find Ladder');
goto DoItAgain; // Goes to DoItAgain:
end;
if WaitUptextMulti(['Clim', 'limb', 'dow'], 600) then
begin
WriteLn('Found Balancing Ladder');
Mouse( x, y, 0, 0, False);
Wait(1000);
end else
begin
WriteLn('Failed to Find Ladder');
goto DoItAgain; // Goes to DoItAgain:
end;
if WaitOptionMulti(['Clim', 'limb', 'b-d'], 600) then
begin
WriteLn('Successfully Clicked on Ladder!');
Exit;
end;
end;
EDIT: didn't look at the way it was coded, pretty insufficient like Engage said.
Better like this:
Simba Code:
function LeavingBalancingLedgeRoomLadder: Boolean;
var
x, y, attempts, TimeOut: integer;
begin
MakeCompass('S');
SetAngle(SRL_ANGLE_HIGH);
Wait(1300 + Random(600)); //Static waiting is bad hmmkay
MarkTime(TimeOut); // starts a failse time-out
repeat
if FindColorSpiralTolerance( x, y, LedgeLadder, 190, 87, 339, 185, 5) then
begin
MMouse(x, y, 2, 2);
if WaitUptextMulti(['Clim', 'limb', 'dow'], 600) then
begin
WriteLn('Found Balancing Ladder');
ClickMouse2(Mouse_right);
Result := WaitOptionMulti(['Clim', 'limb', 'b-d'], 600);
if Result then
begin
WriteLn('Successfully Clicked on Ladder!');
Exit;
end;
end;
end;
until((TimeFromMark(TimeOut) >= 25000)) // if we haven't found it after 25 seconds we leave the loop
if TimeFromMark(TimeOut) >= 25000 then // shut down script if we did not find ladder
begin
Writeln('Did not find Ladder')
TerminateScript;
end;
end;