SRL Archive - SRL Suggestions

TimeStatus


Runaway

2009-09-15 01:17:17

I find that it is better to put a time countdown when a script is sleeping rather than just saying "Sleeping for 12 minutes". So, I made a simple function to disguise SCAR to a timer which counts down how much time is left in whatever you are waiting for.

(sorry if that description is confusing :s)


//-------------------------------------------------------------\\
// Procedure TimeStatus(WaitTime: Integer); ||
// Creates a countdown for however long you input into ||
// WaitTime, and sets it as the SCAR disguise. ||
//-------------------------------------------------------------//

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

3Garrett3

2009-09-15 01:25:11

Can be shortened some :


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

I think that should do the same thing.

But aside from the intrusion there, I think it's a good idea, it's one of my pet peeves not knowing how long the break is going to take.

Sabzi

2009-09-15 01:29:34

What about this?
{*******************************************************************************
function MsToTime(MS, StrType: Integer): string;
By: ZephyrsFury, Nava2, and Rasta Magician
Description: Takes MS in milliseconds and outputs a string with hours, mins and
seconds. Different styles can be created with different StrType values:
Str Type
0: 2 Hours, 47 Minutes and 28 Seconds
1: 02h, 47m, 28s
2: 2 hr, 47 min, 28 sec
3: 02:47:28
4: 12.04.40
*******************************************************************************}
:)
Just put this in the loop at ta da!

Sir R. M8gic1an

2009-09-15 01:29:35


MarkTime(t);
r:= random(2*60*1000);
while TimeFromMark(t) < RestFor+r do
Disguise('Resting for: '+MsToTime(RestFor+r-TimeFromMark(t), Time_Short));
Disguise('working');

From my WCer.

~RM

Runaway

2009-09-15 01:33:41

Darn, didn't know there was already a function for it :(

Sir R. M8gic1an

2009-09-15 01:59:36

From: Runaway Cop
Darn, didn't know there was already a function for it :(


well, not *specifically* for it, but as you can see it doesn't take many lines to do it.

~RM