Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • Can't find "sleepUntil" method description.


    Rubick
     Share

    Recommended Posts

    Been trying to find the sleepUntil method in the Java API with no luck. Any help here, or am I just looking at the wrong API? 

    Link to comment
    Share on other sites

    ur probs better off not using that anyways

     

    Why is that? I'm pretty new so I'll explain what I'm trying to do and you tell me what you think. I'm trying to make a simple feather collector script. All it will do is go around at Lummy chickens and pickup feathers that other players have missed. So once I have the code that says to select "Take" on the feather, I need the script to wait until the feather is picked up to continue. So why not use "sleepUntil(feather count increases)" or something like that? (I haven't quite gotten the syntax and methods but you get the idea.)

     

    It's under MethodProvider

     

    Thank you my friend. Not sure why my Ctrl+F and Google searches didn't find it.

    Link to comment
    Share on other sites

    Why is that? I'm pretty new so I'll explain what I'm trying to do and you tell me what you think. I'm trying to make a simple feather collector script. All it will do is go around at Lummy chickens and pickup feathers that other players have missed. So once I have the code that says to select "Take" on the feather, I need the script to wait until the feather is picked up to continue. So why not use "sleepUntil(feather count increases)" or something like that? (I haven't quite gotten the syntax and methods but you get the idea.)

     

     

    Thank you my friend. Not sure why my Ctrl+F and Google searches didn't find it.

     

    it uses a shit ton of resources and generally isnt needed. 

     

    sleepuntil checks a condition every 25ms and then stops when it returns true.  polling every 25ms is excessive if ur just going to return a 1-2 sec sleep afterwards.  

     

    checking for invent changes isnt a good idea because someone else might pick up the item before you.  for picking up ground items you can cache the item in a global variable and do if(item != null){pickup}

     

    sleepuntil isnt always bad, but try to avoid it unless absolutely necessary.  also never put resource intensive calls like getting widgets/grounditems/pathfinding/etc. in sleepuntil.  

    Link to comment
    Share on other sites

    it uses a shit ton of resources and generally isnt needed. 

     

    sleepuntil checks a condition every 25ms and then stops when it returns true.  polling every 25ms is excessive if ur just going to return a 1-2 sec sleep afterwards.  

     

    checking for invent changes isnt a good idea because someone else might pick up the item before you.  for picking up ground items you can cache the item in a global variable and do if(item != null){pickup}

     

    sleepuntil isnt always bad, but try to avoid it unless absolutely necessary.  also never put resource intensive calls like getting widgets/grounditems/pathfinding/etc. in sleepuntil.  

     

    How can I verify the item was picked up before continuing on? As it stands my script would issue the Pickup command in game, then start looking for another feather immediately. Should I just do a regular sleep timer for a few seconds, knowing it will pick it up in time but never actually confirming the pickup in the code?

    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.