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
  • Alternatives to !getLocalPlayer.isAnimating()


    sachamo2010

    Recommended Posts

    I just started using the bot about a week ago and have written a few simple scripts for myself along the way.  I'm starting to get a good feel for the API and how everything works but I've noticed that isAnimating() can be a bit iffy.  For example, if you're smelting bars, there are times where your player is not technically in any animation but it's in between animations, going from one bar to the next.  The best solution I've come up with is: 

    if (!getLocalPlayer().isAnimating()) {
        if (wc.interact("Make-all")) {
            sleepUntil(() -> !getInventory().contains(bars), Calculations.random(50000, 60000));
        }
    }
    

    This seems to work pretty well, it interacts with the widget and waits until all bars are done and then moves on.  However, if other bars take longer or if you level up before finishing the inventory, etc. then it's stuck waiting 50-60 seconds before it loops back around.  If I lower the times down, then it loops too often and catches on the "not animating" piece.  Is there something that I've missed?  I tend to make simple problems more complicated than they need to be and I get the feeling this is one of those cases.

     

    Thanks in advance for any advice.

    Link to comment
    Share on other sites

    I just started using the bot about a week ago and have written a few simple scripts for myself along the way.  I'm starting to get a good feel for the API and how everything works but I've noticed that isAnimating() can be a bit iffy.  For example, if you're smelting bars, there are times where your player is not technically in any animation but it's in between animations, going from one bar to the next.  The best solution I've come up with is: 

    if (!getLocalPlayer().isAnimating()) {
        if (wc.interact("Make-all")) {
            sleepUntil(() -> !getInventory().contains(bars), Calculations.random(50000, 60000));
        }
    }
    

    This seems to work pretty well, it interacts with the widget and waits until all bars are done and then moves on.  However, if other bars take longer or if you level up before finishing the inventory, etc. then it's stuck waiting 50-60 seconds before it loops back around.  If I lower the times down, then it loops too often and catches on the "not animating" piece.  Is there something that I've missed?  I tend to make simple problems more complicated than they need to be and I get the feeling this is one of those cases.

     

    Thanks in advance for any advice.

    Holy shit you have a 50000ms sleep until... I could probably fix your problem but I'd need to review the whole code. (I know I'm not a scripter here), but I have experience: https://gyazo.com/adb55e1a3dd04a87c36c1fcfae016a76

     

    Let me know if you'd like my help, I get bored.

    Link to comment
    Share on other sites

    I timed a full inventory and it took ~55 seconds so that's why I'm waiting 50-60 seconds on that sleepUntil.  That is what I'm trying to bring down though, it's not really a good way to do things.

     

    I started using this method and things seem to be working out okay:

    if (!DoingSomething()) {
        if (wc.interact("Make-all")) {
            sleepUntil(() -> !getInventory().contains(bars), Calculations.random(100, 200));
        }
    }
    
    private boolean DoingSomething() {
        for (int i = 0; i < 20; i++) {
            if (getLocalPlayer().isAnimating()) { return true; }
            sleep(100);
        }
        return false;
    }

    This method brings the wait time down to 2 seconds with the only downfall being that it takes it 2 seconds to figure out that it's actually not doing anything but it does fix the aforementioned issue.  I tried this method with 1 second (looping to 10) but that didn't seem to cut it, didn't try 1.5 seconds yet

    Link to comment
    Share on other sites

    you can sleepUntil with multiple conditions. you can add in whether you can press continue in the dialogue. but using sleepuntil for that long is not good since its taxing on the cpu.

    Link to comment
    Share on other sites

    I timed a full inventory and it took ~55 seconds so that's why I'm waiting 50-60 seconds on that sleepUntil.  That is what I'm trying to bring down though, it's not really a good way to do things.

     

    I started using this method and things seem to be working out okay:

    if (!DoingSomething()) {
        if (wc.interact("Make-all")) {
            sleepUntil(() -> !getInventory().contains(bars), Calculations.random(100, 200));
        }
    }
    
    private boolean DoingSomething() {
        for (int i = 0; i < 20; i++) {
            if (getLocalPlayer().isAnimating()) { return true; }
            sleep(100);
        }
        return false;
    }

    This method brings the wait time down to 2 seconds with the only downfall being that it takes it 2 seconds to figure out that it's actually not doing anything but it does fix the aforementioned issue.  I tried this method with 1 second (looping to 10) but that didn't seem to cut it, didn't try 1.5 seconds yet

    One thing you might wanna try is seeing how many ticks it takes for the animation to occur and for how many ticks its actually animating, but the method your using is pretty much what I would use. However, you should just remove the sleepUntil and just replace it with like "return 500;" or like "sleep(500);". 

     

    Also 

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

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