SRL Archive - OSR Help

Very quick loop Question


rya

2010-06-30 11:55:49

What do i use to end a repeat loop?
Thanks

Edit: also
Im running this in simba

program new;
{.include SRL/SRL.scar}
Var I:Integer;
begin
SetupSRL;
MarkTime(I);
Wait(50);
TimeFromMark(I)
writeln(IntToStr(I));
end.
But getting really high numbers, im trying to get it to retrun around 50

Thanks again

Frement

2010-06-30 12:30:47

TimeFromMark returns the time that has passed, so use it like: I := TimeFromMark(I);

The I is the time the mark was set.

masterBB

2010-06-30 12:39:43

var donevar := false;

repeat
if(allesklaarIs) then
donevar := true;
if(IetsFoutGaat) then
break;
until(donevar);

Here you have 2 ways to get out of a repeat loop. break and changing the variable in until.

Frement

2010-06-30 13:01:16

You could make a loop like this:
program new;
{$I SRL/SRL.scar}

var I: Integer;

begin
SetupSRL;
MarkTime(I);
repeat
Wait(50);
Writeln(IntToStr(TimeFromMark(I)));
until(TimeFromMark(I) >= 300);
end.

rya

2010-06-30 13:26:15

Thanks break is what i was looking for
thanks

Frement

2010-06-30 13:40:27

Break will break the loop and Exit will exit the function. Should be pretty self-explanatory.

Just for more information on the subject :)