SRL Archive - OSR Help

TimeStamp


P1ng

2012-06-26 02:54:00

Is there anyway to time time stamp the lines written in the debug of a script?

For example if I have a breaking procedure and each time it takes a break it writes something like "Taking a break for 17m 30s"

Is it possible to associate a time with this message so I have a rough idea of what time my bot will be back up and doing it's thing?

Runaway

2012-06-26 02:58:14

Had to go back pretty far to dig this one up!

http://villavu.com/forum/showthread.php?t=50862

^ It's for SCAR but I'm sure it'll work just fine with Simba. :)

EDIT: Simba version isn't any different:


procedure TimeStatus(WaitTime: Integer);
var
Hours, Minutes, Seconds, Time: Integer;
Ticker: String;
begin
MarkTime(Time);
while (WaitTime > TimeFromMark(Time)) do
begin
Wait(500);
ConvertTime(WaitTime - TimeFromMark(Time), Hours, Minutes, Seconds);
if (Hours > 0) and (Minutes > 0) then
Ticker := ToStr(Hours) + ':' + ToStr(Minutes) + ':' + ToStr(Seconds);
if (Hours = 0) and (Minutes > 0) then
Ticker := ToStr(Minutes) + ':' + ToStr(Seconds);
if (Hours = 0) and (Minutes = 0) then
Ticker := ToStr(Seconds);
Status('Waiting for: ' + Ticker);
end;
end;

Nebula

2012-06-26 03:06:10

Or you could use TheTime;

writeln('Taking a break for ' + BreakTime + ' at ' + TheTime);

Something like that. I'm terrible at writeln's.

P1ng

2012-06-26 03:16:31

Very cool, I really like the idea of having it real-time up in the status bar :) Many thanks!

EDIT:

Changed it around somewhat to suit my preferences a little better and used MsToTime to cut down on some lines of code but here is what I'm using now :)

procedure TimeStamp(WaitTime: Integer);
var
T: Integer;
Ticker: String;
begin
MarkTime(T);
while (WaitTime > TimeFromMark(T)) do
begin
Wait(500);
Ticker := MsToTime(WaitTime - TimeFromMark(T), Time_Short);
Status('Break remaining: ' + Ticker);
end;
end;

masterBB

2012-06-26 04:54:59

SetScriptProp(SP_WriteTimeStamp, [True]);

That is the best way.

Parade

2012-06-27 05:22:44

From: masterBB
SetScriptProp(SP_WriteTimeStamp, [True]);

That is the best way.


hahah I was looking in the "Not Well Known Features" of the simba docs and saw that there a few weeks ago.

http://docs.villavu.com/simba/features/notwellknown.html#timestamped-writeln

The downside of using this is that the time is based on when you started you script, not your clock's time.