Results 1 to 7 of 7

Thread: PrintTime

  1. #1
    Join Date
    Oct 2011
    Location
    Vegas :D
    Posts
    80
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default PrintTime

    Simba Code:
    {*******************************************************************************
    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?

  2. #2
    Join Date
    Sep 2007
    Location
    British Columbia, Canada
    Posts
    4,047
    Mentioned
    1 Post(s)
    Quoted
    2 Post(s)

    Default

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

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

  3. #3
    Join Date
    Oct 2011
    Location
    Vegas :D
    Posts
    80
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Main View Post
    Very good mate, but unfortunately we already have TimeRunning like
    Simba Code:
    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.

  4. #4
    Join Date
    Sep 2007
    Location
    British Columbia, Canada
    Posts
    4,047
    Mentioned
    1 Post(s)
    Quoted
    2 Post(s)

    Default

    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.
    Oh Hai Dar

  5. #5
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    You can also add this to your script:
    Simba Code:
    SetScriptProp(SP_WriteTimeStamp, [true]);
    That will print the time automatically before any writeln calls.

  6. #6
    Join Date
    Feb 2006
    Location
    Aussie
    Posts
    937
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Coh3n View Post
    You can also add this to your script:
    Simba Code:
    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?

  7. #7
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Jagex_Fagex View Post
    So call that in the script setup stuff, then after that, every writeln will be time stamped?
    Yes.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •