Spaceblow
2014-08-14 17:24:16
I'm adjusting a procedure to make it better but now I don't know what to do. It's the 2 break; lines I have problems with (I commented them out so it would be clear what I'm talking about). When I try to run the script the following shows up:
This happens also for the second break;. I really don't know what I'm doing wrong here, why couldn't it break out of that? This is my procedure:
And a second question: would it somehow be possible to terminate the script after like 2 minutes of running the procedure? Yes, I'm aware of timer.start() and timer.getTime() but if I would want to use that, I would have to put the whole procedure in a 'repeat … until timer.getTime()', right? But if I would want to use break;, it would go to the beginning of the procedure, so the timer.start() would constantly just start over and it would never reach the 2 minutes, is that correct? Thanks in advance!
Exception in Script: Cannot break out of this statement at line 93, column 7This happens also for the second break;. I really don't know what I'm doing wrong here, why couldn't it break out of that? This is my procedure:
procedure bankRedberries();
var
bankTimer: TTimeMarker;
pathFail: TPointArray;
begin
if not isLoggedIn() then
exit;
if not tabBackpack.isFull() then
exit;
minimap.setAngle(MM_DIRECTION_SOUTH);
mainScreen.setAngle(MS_ANGLE_HIGH);
bankScreen.open(BANK_NPC_BLUE);
wait(randomRange(750, 1250));
if bankScreen.isOpen() then
begin
bankTimer.start();
writeLn('--------------------------------------------------------------------------- Succesfully opened the bank');
repeat
begin
wait(randomRange(600, 900));
bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
wait(randomRange(600, 900));
bankScreen.close();
writeLn('--------------------------------------------------------------------------- Succesfully closed the bank.');
end;
until(tabBackpack.isEmpty()) or (not isLoggedIn()) or (bankTimer.getTime() > 7000);
if tabBackpack.isEmpty() then
begin
writeLn('--------------------------------------------------------------------------- Succesfully banked Redberries.');
inc(loadsDone);
wait(randomRange(750, 1250));
writeLn('--------------------------------------------------------------------------- Running to redberries.');
end;
end else
begin
writeLn('--------------------------------------------------------------------------- Could not open bank, trying to find it.');
wait(randomRange(750, 1000));
pathFail:= [Point(118, 133), Point(118, 169)]; //in case the player somehow didn't got in the bank, but outside of it
if SPS.walkPath(pathFail) then
minimap.waitPlayerMoving();
wait(randomRange(750, 1000));
//break; //so when the player got in the bank, it needs to break so it would try to open the bankscreen again
end;
if tabBackpack.isEmpty() then
begin
exit;
end else
//break; //so it would restart to try to open the bankscreen again in case the backpack somehow isn't empty
end; And a second question: would it somehow be possible to terminate the script after like 2 minutes of running the procedure? Yes, I'm aware of timer.start() and timer.getTime() but if I would want to use that, I would have to put the whole procedure in a 'repeat … until timer.getTime()', right? But if I would want to use break;, it would go to the beginning of the procedure, so the timer.start() would constantly just start over and it would never reach the 2 minutes, is that correct? Thanks in advance!