Hey,
I started work on my teleporter a few days back and seems to be going well. (considering its my first).
The main bulk of the code is the teleport procedure, and im having trouble with it.
SCAR Code:
procedure Teleport;
var
i : integer;
begin
jobDone := False;
repeat
writeln('first repeat');
i := 0
repeat
writeln('sencond repeat');
wait(100)
if (not(FindFastRandoms)) then
begin
wait(500 + random(500));
if (Cast(TeleportTo + ' Teleport')) then
begin
wait(500 + random(500));
Teleported := Teleported + 1;
writeln('Teleported = ' + inttostr(Teleported));
wait(500 + random(500));
i := i + 1;
writeln('i = ' + inttostr(i));
wait(2500 + random(500));
end else
begin
if (FindFastRandoms) or (FindNormalRandoms) then
begin
NextPlayer(False);
writeln('Stuck in an unsolvable random!')
writeln('Unable to continue PowerTeleporting')
end else
begin
NextPlayer(False);
end;
end;
end else
NextPlayer(False);
until(i >= 1 + random(2));
writeln('first repeat finished')
writeln('FindFastRandoms');
FindFastRandoms;
wait(100);
writeln('FindNormalRandoms');
FindNormalRandoms;
wait(100);
checkLvlXP;
wait(100);
case TeleportUntil of
'Certain Level' : if CurrentLevel >= Achieve then jobDone := True;
'Certain XP' : if CurrentXP >= Achieve then jobDone := True;
end;
writeln('CurrentLevel = ' + inttostr(CurrentLevel));
writeln('CurrentXP = ' + inttostr(CurrentXP));
writeln('Achieve = ' + inttostr(Achieve));
if (jobDone) then writeln('jobDone = True');
until(jobDone);
end;
All those writeln's are for debug as i didnt know why it wasnt working. Same with most waits.
The second repeat untill(jobDone) doesnt work.
jobDone is set to true (shown by the writeln) but it doesnt break out of the procedure.
Can some1 have a look at see if they can see whats wrong with it.
Thanks