SRL Archive - OSR Help

Time Running


Death12652

2010-05-29 02:23:00

Is there a way to display how long scar has been running in the debug box? Also how long part of the script has been running? Particularly a series or section in the main loop? Also a way for it to average the continuation of that loop with the previous runs?

i luffs yeww

2010-05-29 02:50:34


{$i SRL/SRL.scar}
var
x, i, lolwut: Integer;

procedure wat;
var
T: Integer;
begin
T := 0;
MarkTime(T); //Starts the 'counter.'
Wait(Random(1000));
x := TimeFromMark(T); //Gets the time since the 'counter' was started.
end;

procedure TheTimeIs;
var
h, m, s, ms: Word;
begin
DecodeTime(Now, h, m, s, ms);
{
if(h > 12)then
begin
h := h - 12;
Writeln(IntToStr(h) + ':' + IntToStr(m) + ':' + IntToStr(s) + ':' + IntToStr(ms) + ' PM');
Exit;
end;
}
//Remove the { and } to make it 12 hour format.
Writeln(IntToStr(h) + ':' + IntToStr(m) + ':' + IntToStr(s) + ':' + IntToStr(ms));
end;

begin
SetupSRL;
Writeln(TimeRunning); //Returns how long it's been since SRL has been compiled. Disregards milliseconds, rounds down.
Writeln(GetTimeRunning); //Returns how long it's been since the play button was pressed, so it's a little longer than TimeRunning
repeat
wat;
IncEx(i, x);
Inc(lolwut);
until(lolwut > 1);
Writeln(i / lolwut); //i is how many milliseconds it's been, lolwut is how many times the procedure ran, thus getting the average of i.
Writeln(GetSystemTime); //Returns the system's time, but there is a better, easier to understand way.
TheTimeIs; //Returns the system time in a sexier way. It's in a 24 hour format.
end.

Gu3st...

2010-05-29 05:30:22

If you include SRL then just do
WriteLn(TimeRunning);

It's in core/Timing.scar

i luffs yeww

2010-05-29 05:48:28

Added TimeRunning and comments. :)

Death12652

2010-05-29 11:45:42

For i luffs yeww I get this


[Error]: Unable to find file 'SRL/SRL.scar' used from ''

For the others I get this


Line 3: [Error] (3:9): Unknown identifier 'TimingRunning' in script

ZephyrsFury

2010-05-29 12:48:06

From: death12652


Line 3: [Error] (3:9): Unknown identifier 'TimingRunning' in script


TimeRunning not TimingRunning. You can also use GetTimeRunning to return the integer number of milliseconds since the script started.

eg.


WriteLn(TimeRunning);

or


Writeln(GetTimeRunning);

i luffs yeww

2010-05-29 13:42:42

Also, you have to run mine in Simba.