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
  • SleepUntill condition faild


    abouhanafy87

    Recommended Posts

    hellow every body

    my SleepUntil condition didn't work with me > this is my code can any one try it .

    in the mother load mining area.

    nodefilter = g-> g!=null && g.exists() && Mining_area.contains(g) && g.getName().equals("Ore vein");
    
    currentNode = GameObjects.closest(nodefilter);
    if (currentNode.interactForceLeft("Mine")) {
      
          Sleep.sleepUntil(()-> !currentNode.exists() || Inventory.isFull(), 25000);//didn't work here and sleep for 25 s every time.
    
    }

    what's about you ?

    Are this happen with any one of you ?

    @Pandemic

    Link to comment
    Share on other sites

    Try logging the output of those two statements to see their values, you may realise the predicate is never true.

    if (currentNode.interactForceLeft("Mine")) {
      
          Sleep.sleepUntil(()-> {
            Logger.log("currentNode.exists(): " + currentNode.exists());
            Logger.log("Inventory.isFull(): " + Inventory.isFull());
            return !currentNode.exists() || Inventory.isFull()
          }, 25000);
    }

     

    Link to comment
    Share on other sites

    GameObject.closest() can return null, so make sure You check if it's null, then if exists

    i.e

    Sleep.sleepUntil(() -> currentNode == null || !currentNode.exists() || Inventory.isFull(), 25000)

    Link to comment
    Share on other sites

    On 2/3/2023 at 8:13 AM, abouhanafy87 said:

    hellow every body

    my SleepUntil condition didn't work with me > this is my code can any one try it .

    in the mother load mining area.

    nodefilter = g-> g!=null && g.exists() && Mining_area.contains(g) && g.getName().equals("Ore vein");
    
    currentNode = GameObjects.closest(nodefilter);
    if (currentNode.interactForceLeft("Mine")) {
      
          Sleep.sleepUntil(()-> !currentNode.exists() || Inventory.isFull(), 25000);//didn't work here and sleep for 25 s every time.
    
    }

    what's about you ?

    Are this happen with any one of you ?

    @Pandemic

    the node probably never stops existing, maybe its actions change and you can tell from that

    Link to comment
    Share on other sites

    On 2/4/2023 at 8:43 AM, prechcik said:

    GameObject.closest() can return null, so make sure You check if it's null, then if exists

    i.e

    Sleep.sleepUntil(() -> currentNode == null || !currentNode.exists() || Inventory.isFull(), 25000)

    nodefilter check this .

    nodefilter = g-> g!=null && g.exists() && Mining_area.contains(g) && g.getName().equals("Ore vein");

    Link to comment
    Share on other sites

    On 2/3/2023 at 9:06 PM, hashbang said:

    Try logging the output of those two statements to see their values, you may realise the predicate is never true.

    if (currentNode.interactForceLeft("Mine")) {
      
          Sleep.sleepUntil(()-> {
            Logger.log("currentNode.exists(): " + currentNode.exists());
            Logger.log("Inventory.isFull(): " + Inventory.isFull());
            return !currentNode.exists() || Inventory.isFull()
          }, 25000);
    }

     

    i try this and the result :

    currentNode.exists(): false

    Inventory.isFull(): false

    and still sleep to 25 s.

    i try to check it by name

    if (currentNode.interactForceLeft("Mine")) {

    Sleep.sleepUntil(()-> {

    Logger.log("currentNode.isOrevein: " + currentNode.getName.equal("Ore vein"));

    Logger.log("Inventory.isFull(): " + Inventory.isFull());

    return !currentNode.exists() || Inventory.isFull();

    }, 25000); }

    the result :

    currentNode.isOrevein:true   // when the currentNode name is " Depleted vein"

    Inventory.isFull(): false

    Link to comment
    Share on other sites

    I would recommend either to check the veins by their ids as they change, or look for another way of waiting until certain condition finished. 

    As to the mining, is there anything stopping you from executing the left click only if Player is not animating? Afaik mining animation doesnt flicker so You could sleep while animating - that would prevent it from clicking again when already mining.

    Your name comparison is kind of weird, you said you used currentNode.getName() .equals("Ore vein") and then when the vein had name Depleted vein it still returned true, that would point out that you are comparing the wrong object. 

    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
    ×
    ×
    • 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.