SRL Archive - SRL Suggestions

PrintTime


PhaseCode

2012-01-17 03:42:10

{*******************************************************************************
function PrintTime(reason : String) : String;
By: PhaseCode
Description: Prints The Current Time, with the specified reason.

reason - The reason for printing the time.
Example : Writeln(PrintTime('Found Bank At')); => Found Bank At: 0:40:24
*******************************************************************************}
function PrintTime(reason : String) : String;
var
H,M,S,MS : Word;
begin
DecodeTime(Now,H,M,S,MS);
if(StrToInt(H) = 0) then
Result := (reason + ' ' + ToStr(H) + ':' + ToStr(M) + ':' + ToStr(S));
end;

This function I reuse a lot. What do you guys think?

Main

2012-01-17 03:52:14

Very good mate, but unfortunately we already have TimeRunning like
Writeln(' Time is' + TimeRunning);  

Very nice thou, you could learn about trying to make your own srl functions, even thou they already exisit:P

PhaseCode

2012-01-17 04:00:22

From: Main
Very good mate, but unfortunately we already have TimeRunning like
Writeln(' Time is' + TimeRunning);  

Very nice thou, you could learn about trying to make your own srl functions, even thou they already exisit:P


:O I did not know about the TimeRunning method. Now I feel stupid.

Main

2012-01-17 04:28:07

nonono! Don't be. Its good trying to come up with your own functions, infact its a good skill because you won't be relying on other people and you will just try to get things done you know…

Infact, in my clan war fighter, most of my "custom function" was just a rip off one way or another of some SRL functions (which I didn't know about) and just later realized it.

Coh3n

2012-01-17 16:58:50

You can also add this to your script:

SetScriptProp(SP_WriteTimeStamp, [true]);
That will print the time automatically before any writeln calls. :)

Jagex_Fagex

2012-02-02 21:50:27

From: Coh3n
You can also add this to your script:

SetScriptProp(SP_WriteTimeStamp, [true]);
That will print the time automatically before any writeln calls. :)


So call that in the script setup stuff, then after that, every writeln will be time stamped?

Coh3n

2012-02-03 01:35:39

From: Jagex_Fagex
So call that in the script setup stuff, then after that, every writeln will be time stamped?
Yes.