SRL Archive - SRL Development and Help

Repeat until 1 hour has passed


TomTop

2014-10-19 12:24:15

Hey,

Just a quick question that I've been thinking about for a little while and haven't found a way how to do it.

How would I make my script run the Repeat loop until one hour has passed (And the option to make it 2,3,4, etc hours.) ?

Thanks in advance.

Frement

2014-10-19 12:31:23

var someTimer: TTimeMarker;

begin
someTimer.start();
repeat
//Do this and that
until(someTimer.getTotalTime() > (60 * 60 * 1000));
end.

TomTop

2014-10-19 12:35:03

From: Frement
var someTimer: TTimeMarker;

begin
someTimer.start();
repeat
//Do this and that
until(someTimer.getTotalTime() > (60 * 60 * 1000));
end.


Wow, thanks for the fast reply, now, How would I go about making it run for lets say, 2 hours? Replace the first 60 with 120?

Frement

2014-10-19 12:36:58

From: TomTop
Wow, thanks for the fast reply, now, How would I go about making it run for lets say, 2 hours? Replace the first 60 with 120?


const hoursToRun = 2;

var someTimer: TTimeMarker;

begin
someTimer.start();
repeat
//Do this and that
until(someTimer.getTotalTime() > (hoursToRun * 60 * 60 * 1000));
end.

TomTop

2014-10-19 12:40:40

Thanks again!

TomTop

2014-10-22 11:22:29

I haven't managed to get it working, It doesn't stop after 1hr has passed, it keeps going.
But no error messages show.

Lipcot

2014-10-22 11:40:27

From: TomTop
I haven't managed to get it working, It doesn't stop after 1hr has passed, it keeps going.
But no error messages show.


show your code

TomTop

2014-10-22 12:21:56

From: undorak7
show your code



program Private;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}

var
someTimer: TTimeMarker;
sent: integer;

*snip*

begin
smartShowConsole := FALSE;
smartEnableDrawing := TRUE;
cleardebug();
setupSRL();

repeat
TalkFast(color + ':[ ' + name + ' ] ' + message + ' [ ' + name + ' ]', true);
wait(RandomRange(2950, 3050));
until(someTimer.getTotalTime() > (hoursToRun * 60 * 60 * 1000));
end.

Lipcot

2014-10-22 13:24:48

From: TomTop

program Private;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}

var
someTimer: TTimeMarker;
sent: integer;

*snip*

begin
smartShowConsole := FALSE;
smartEnableDrawing := TRUE;
cleardebug();
setupSRL();

repeat
TalkFast(color + ':[ ' + name + ' ] ' + message + ' [ ' + name + ' ]', true);
wait(RandomRange(2950, 3050));
until(someTimer.getTotalTime() > (hoursToRun * 60 * 60 * 1000));
end.


you are missing this

someTimer.start();

after the begin.. you never start the timer, so it never reaches the hour

TomTop

2014-10-22 14:53:46

Got it working (finally) thanks a lot!