Results 1 to 5 of 5

Thread: Procedure for sleep?

  1. #1
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default Procedure for sleep?

    I was wondering how you make a procedure for sleeping, as in my script I have the option of every 50 mins sleep.

    Thanks

    DR

  2. #2
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    Well depends on what do you mean by sleeping?

    But if you want to logout and wait and login every 50mins, make a proc like

    SCAR Code:
    Procedure Sleeper;
    Begin
      Logout;
      Wait(1000 + Random(5000));
      LoginPlayer;
      SetTimeOut(3000, 'Sleeper');
    End;

    and in the beginning of your script have "SetTimeout(3000, 'Sleeper');"

  3. #3
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    I know how to do that much, but I want to know how to get to log out after 50 mins of running, then 1hr 40 etc.

    The only way I've done it so far is by it does 1 loads of long(u) (its a fletcher) and wait 50 mins it logs out.

  4. #4
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    You can make a short procedure like this:
    SCAR Code:
    Procedure CheckTime;
    Begin
      If(runTime = 0) Then
        MarkTime(runTime)
      Else If(TimeFromMark(runTime)>=(3000000)) Then
      Begin
        Logout;
        NextPlayer(True);
        MarkTime(runTime);
      End;
    End;
    Then just decalre runTime as an integer at the beginning and call the procedure somewhere in the mainloop (best if at a good point - like after dropping a load for a powerminer/wc'er or after banking for a wc'er and banker etc.).

    The procedure just sets runTime as the current system time (using MarkTime) then if the difference between runTime and the current system time is bigger than 3000000 (1000*60*50 = 50 minutes) and if it is, then it logs out the current user then switches to the next user, keeping the previous as true (as nothing stopped it from running - the time limit was just surpassed).

  5. #5
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    Thanks for this, now my script can have a sleep time

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Sleep Every..?
    By D1zl3 in forum OSR Help
    Replies: 15
    Last Post: 12-17-2008, 05:56 PM
  2. Sleep
    By sirlaughsalot in forum OSR Help
    Replies: 6
    Last Post: 05-24-2008, 08:41 PM
  3. Sleep (LogOutEvery)
    By Baked0420 in forum OSR Help
    Replies: 19
    Last Post: 05-18-2008, 08:03 AM
  4. Sleep not working
    By Maiki in forum OSR Help
    Replies: 12
    Last Post: 09-30-2007, 08:02 PM

Posting Permissions

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