Results 1 to 16 of 16

Thread: Sleep Every..?

  1. #1
    Join Date
    Oct 2006
    Location
    United States
    Posts
    672
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Sleep Every..?

    Im trying to figure out how I would make the script log out for about 5 minutes plus a random 5 minutes which I have, but I want it to log out every say 8 plus 4 random loads. For my proggy, every time it banks, it has inc(Runz), so would it be something like if runz = 8+Random(4) then? But that wouldnt work because it wouldnt sleep after it logged back in. This is what I have now.

    SCAR Code:
    procedure Breaks;
    begin
      if (Runz = 8+Random(4)) then
      Logout;
      Disguise('Sleeping...');
      Wait(600000+Random(600000));
      Loginplayer;
    end;

  2. #2
    Join Date
    Oct 2007
    Location
    The deep web
    Posts
    2,496
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    SCAR Code:
    Sleepez         = True;    // Do you want your characters to sleep?
      SleepEvery      = 9;       // 9 mins works good.
      SleepForHowLong = 1;       // Lets keep it short shall we? Random 1-1.5mins will be added.
     
     
     
     
     
     
     
     
     
      Procedure Sleepy;
    Begin
      If Not LoggedIn then Exit;
      If Not Sleepez then Exit;
      Begin
        Logout;
        TimesSlept:=TimesSlept+1;
        Status('Sleeping...');
        Sleep(SleepForHowLong*60000+RandomRange(30000,90000));
        Status('Finished Sleeping...');
        LoginPlayer;
      end;
    end;

    cant remember who made it.
    Did someone say GDK?

  3. #3
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    after loginplayer; do runz:=0 so it starts over, and if you want to know how many runz it's done total then do another integer to hold totalrunz, then runz can be can be just for sleeping. Hope that helped.

  4. #4
    Join Date
    Oct 2006
    Location
    United States
    Posts
    672
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Edit: I got this, but this logs out everytime it does the procedure.(everytime it banks)

    SCAR Code:
    const
      Sleepez         = True;    // Do you want your characters to sleep?
      SleepEvery      = 1;       // Sleep Every Number Of Minutes
      SleepForHowLong = 1;       // How Long To Sleep For + Random 1 - 1.5 Minutes

    SCAR Code:
    procedure Breaks;
    begin
      if not LoggedIn then Exit;
      if not Sleepez then Exit;
      Begin
        Logout;
        TimesSlept:= TimesSlept+1;
        Status('Sleeping...');
        Sleep(SleepForHowLong*60000+RandomRange(30000,90000));
        LoginPlayer;
      end;
    end;

  5. #5
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You have to check if 1 minute(in that case) has passed:
    SCAR Code:
    begin // main loop
      SetupSRL;
      //the rest of the main loop
      repeat
        // main part of the loop
        TR := GetTimeRunning;
        If ((SleepEvery * 60000) - TR) <= 0) And (Sleepz) Then
        Begin
          Logout;
          Etc...
        End;
      Until X
    End.


  6. #6
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    if runz mod 4 = 0 then Sleep;

    That'll sleep every fourth run. :3

  7. #7
    Join Date
    Oct 2006
    Location
    United States
    Posts
    672
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I fixed it thanks to everyone that helped This is what I went with.

    SCAR Code:
    const
      Sleepez         = True;    // Do you want your characters to sleep?
      SleepAfterLoads = 2;       // Sleep After How Many Loads Completed + Random 4 Loads
      SleepForHowLong = 1;       // How Long To Sleep For + Random 1 - 1.5 Minutes

    SCAR Code:
    procedure Breaks;
    begin
      if not LoggedIn then Exit;
      if not Sleepez then Exit;
      begin
        if Runz+Random(4) = SleepAfterLoads then
        begin
          Disguise('Sleeping...');
          Logout;
          TimesSlept:= TimesSlept+1;
          Sleep(SleepForHowLong*60000+RandomRange(30000,90000));
          LoginPlayer;
          Runz := 0;
        end;
      end;
    end;

  8. #8
    Join Date
    Jul 2008
    Posts
    907
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    you need to make it <> not just = in Runz+random(4) otherwise it'll only do it when it equals it exactly


  9. #9
    Join Date
    Oct 2006
    Location
    United States
    Posts
    672
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by SandoS View Post
    you need to make it <> not just = in Runz+random(4) otherwise it'll only do it when it equals it exactly
    So like this?
    Runz+Random(4) >= SleepAfterLoads

  10. #10
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Quote Originally Posted by D1zl3 View Post
    So like this?
    Runz+Random(4) >= SleepAfterLoads
    Yup. Because the way you had it before, you could theoretically be in a situation that it would never trigger.

  11. #11
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    ^Not really. That's pretty simple imo. But you will get there eventually

    ~Camo
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


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

    Default

    is this correct? (sorry for posting in some one else's thread, but i didn't want to make an other thread, and yes i tried search. and i couldn't find the old smart topic)

    SCAR Code:
    SmartSetupEx('129', true, false, false);
      SmartSetTarget;
      wait(1000

    Is it right? it gives me typemistmatch
    Oh Hai Dar

  13. #13
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    Quote Originally Posted by M_A_I_N_FTW View Post
    is this correct? (sorry for posting in some one else's thread, but i didn't want to make an other thread, and yes i tried search. and i couldn't find the old smart topic)

    SCAR Code:
    SmartSetupEx(129, true, false, false);
      Wait(2000);
      SetTargetDC(SmartGetDC);

    Is it right? it gives me typemistmatch
    Check the code above in the quote. You were close

    ~Camo
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  14. #14
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Quote Originally Posted by Camo¤Kyle View Post
    ^Not really. That's pretty simple imo. But you will get there eventually

    ~Camo
    No, really. He had it set up originally to only trigger when Runz+Random(4) = SleepAfterLoads. Imagine this situation:
    SleepAfterLoads is set to 5. Lets say Random(4) returns 2 the first time. 3!=5, so the sleep doesn't trigger. Lets say it returns 2 again the second time, 4!=5, so the sleep doesn't trigger. Now, lets say it returns 1 on the third run, 4!=5, so the sleep doesn't trigger. Lets say it returns 0 on the fourth run, 4!=5, so the sleep doesn't trigger. Now we're on the fifth run, the last chance for it to trigger. If the Random(4) returns anything but 0, this means it would never trigger

    So, yes, there was the possibility that with his old code, it would never be triggered.

  15. #15
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    Quote Originally Posted by senrath View Post
    No, really. He had it set up originally to only trigger when Runz+Random(4) = SleepAfterLoads. Imagine this situation:
    SleepAfterLoads is set to 5. Lets say Random(4) returns 2 the first time. 3!=5, so the sleep doesn't trigger. Lets say it returns 2 again the second time, 4!=5, so the sleep doesn't trigger. Now, lets say it returns 1 on the third run, 4!=5, so the sleep doesn't trigger. Lets say it returns 0 on the fourth run, 4!=5, so the sleep doesn't trigger. Now we're on the fifth run, the last chance for it to trigger. If the Random(4) returns anything but 0, this means it would never trigger

    So, yes, there was the possibility that with his old code, it would never be triggered.
    Lol I know what you're saying, but a guy had a post saying that was complicated stuff above me. That's who I was quoting mostly, sorry for the confusion But yes, the way he had it setup wasn't the best way to do it.

    ~Camo
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  16. #16
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    Erm.. why not just do something like:
    SCAR Code:
    Program New;
    {.include SRL\SRL.scar}

    Var
      TR, Taim : Integer;

    Const
      SleepT  = 10; // Sleep every (..) mins
      SleepHL = 2;  // Sleep (..+Random(3)) mins

    Procedure DoSleep; // From my Chicken buyer, edited a bit
    Var
      WaitT, Q, i, SL : Integer;
    Begin
      If TimeFromMark(TR) > Taim Then
      Begin
        CloseWindow;
        SL := ((SleepHL+Random(3)) * 60000);
        IncEx(Taim, (SleepT * 60000));
        Logout;
        MarkTime(WaitT);
        Q := 60000;
        While TimeFromMark(WaitT) < SL Do
        Begin
          If TimeFromMark(WaitT) >= Q Then
          Begin
            Inc(i);
            WriteLn('Sleeping... '+ IntToStr(i) +' min.');
            IncEx(Q, 60000);
          End;
        End;
        WriteLn('Waking up.');
        LoginPlayer;
      End;
    End;

    Begin
      SetupSRL;
      Taim := (SleepT * 60000);
      TR   := 0;
      MarkTime(TR);
    End.
    Ce ne sont que des gueux


Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Sleep
    By sirlaughsalot in forum OSR Help
    Replies: 6
    Last Post: 05-24-2008, 08:41 PM
  2. Procedure for sleep?
    By Richard in forum OSR Help
    Replies: 4
    Last Post: 02-11-2008, 06:00 PM
  3. 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
  •