Incurable
2014-09-28 04:28:57
So I recently realised that when my script is logged out for whatever reason, it won't actually log in. I changed this:
… to this:
… with advice from slacky and Dgby714.
However, the script terminates when it reaches my Terminate procedure, as commented below:
I'm testing the script by letting it get to FillVials, and while they're filling, pausing the script and logging out. I had hoped that this would just break out of the repeat..until and then go back to the start of MainLoop, but it's not. Instead it's terminating the whole script which makes me unsure of whether or not it will do the same if it's logged out via lag/etc.
Any ideas?
EDIT: It just did it after 4 hours and 23 minutes, so the script definitely does not log back in once logged out via lag. :(
repeat
UseBank();
WalkToFountain();
FillVials();
WalkToBank();
ProgRep();
until ((numFilled >= CFG_NUM_TO_FILL) or (failCount >= 3)));
… to this:
repeat
UseBank();
WalkToFountain();
FillVials();
WalkToBank();
ProgRep();
until ((numFilled >= CFG_NUM_TO_FILL) or (failCount >= 3) or (not isLoggedIn()));
… with advice from slacky and Dgby714.
However, the script terminates when it reaches my Terminate procedure, as commented below:
// Main loop to be performed while the script is active
procedure MainLoop();
begin
// If not logged in, log in
if (not isLoggedIn()) then
begin
players[currentPlayer].login();
writeLn('SUCCESS: Logged in');
end;
if (isLoggedIn() and tabBackpack.isEmpty()) then
begin
SetupScreen();
writeLn('STATUS: Walking to bank to do banking');
WalkToBank();
end;
repeat
UseBank();
WalkToFountain();
FillVials();
WalkToBank();
ProgRep();
until ((numFilled >= CFG_NUM_TO_FILL) or (failCount >= 3) or (not isLoggedIn()));
if (numFilled >= CFG_NUM_TO_FILL) then
begin
writeLn('SUCCESS: Filled desired vials, remember to post a proggy! :D');
isScriptRunning := false;
end else
if (failCount < 3) then // This is reached and printed in debug despite failCount being 0 when testing
writeLn('ERROR: Errr... the number of vials filled appears to be less than you wanted filled. Please post a proggy + debug on the forum.');
if (failCount = 3) then // This is reached too
writeLn('FATAL ERROR: Script failCount = 3, terminating script.');
Terminate('failCount >= 3');
end;
{ ============================================================================ }
// Main procedure
begin
SetupEverything();
while(isScriptRunning) do
MainLoop();
EndScript();
end.
I'm testing the script by letting it get to FillVials, and while they're filling, pausing the script and logging out. I had hoped that this would just break out of the repeat..until and then go back to the start of MainLoop, but it's not. Instead it's terminating the whole script which makes me unsure of whether or not it will do the same if it's logged out via lag/etc.
Any ideas?
EDIT: It just did it after 4 hours and 23 minutes, so the script definitely does not log back in once logged out via lag. :(