Results 1 to 6 of 6

Thread: TimeStatus

  1. #1
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default TimeStatus

    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)

    SCAR Code:
    //-------------------------------------------------------------\\
    //   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;

  2. #2
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Can be shortened some :

    SCAR Code:
    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.

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  3. #3
    Join Date
    Feb 2009
    Location
    Hungary (GMT + 1)
    Posts
    1,774
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What about this?
    SCAR Code:
    {*******************************************************************************
    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!

  4. #4
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    SCAR Code:
    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

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  5. #5
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

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

  6. #6
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    Quote Originally Posted by Runaway Cop View Post
    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

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

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
  •