UkBenH Posted October 17, 2020 Share Posted October 17, 2020 I've edited a script to do what I like, but sometimes when it walks back to the bank tile it'll stand idle until I move my character, where it'll then interact with the bank chest. My bank code is as follows: public void handleBank() throws InterruptedException { if (!getBank().isOpen()){ //If the bank is not open getBank().open(); //Opens bank chests, booths, etc. if (getBank().isOpen()) { getBank().depositAll(); if (getBank().close()) { Sleep.sleepUntil(() -> !getBank().isOpen(), 4000); } } } } I know nothing about scripting but I'd like to add some sort of failsafe to re-check it can use the bank chest somehow? Quote Link to comment Share on other sites More sharing options...
Gunman Posted October 17, 2020 Share Posted October 17, 2020 (edited) @UkBenHNeed more code, and post it on https://pastebin.com/ EDIT: Also the if's are nested and will get stuck if the bank is already open Edited October 17, 2020 by Gunman Quote Link to comment Share on other sites More sharing options...
UkBenH Posted October 17, 2020 Author Share Posted October 17, 2020 (edited) 19 minutes ago, Gunman said: @UkBenHNeed more code, and post it on https://pastebin.com/ EDIT: Also the if's are nested and will get stuck if the bank is already open https://pastebin.com/M3QpyfX3 This is the full thing. I had to change the bank method to use the chest that's nearby as it was set up to use a depositbox. Now sometimes it'll walk to the bank area and stand idle Edit: It idles when you run out of energy mid-way to the bank Edited October 17, 2020 by UkBenH Quote Link to comment Share on other sites More sharing options...
Gunman Posted October 17, 2020 Share Posted October 17, 2020 4 minutes ago, UkBenH said: https://pastebin.com/M3QpyfX3 This is the full thing. I had to change the bank method to use the chest that's nearby as it was set up to use a depositbox. Now sometimes it'll walk to the bank area and stand idle My guess is it's getting stuck because of web walking. Web walking by default will complete if a tile off. But I would just change the position to an area which I think the same area you're walking to is in the Banks API. I would probably restructure it like this private void handleBank() throws InterruptedException { if (getBank().isOpen()) { currentState = "Depositing"; if (getBank().depositAll()) { Sleep.sleepUntil(() -> getInventory().isEmpty(), 4000); } } else if (!getBank().open()) { currentState = "Navigating to bank"; getWalking().webWalk(Banks.HOSIDIUS_HOUSE); } } And the first if in the onLoop I would change to just this if (getInventory().isFull()) { handleBank(); } If Banks.HOSIDIUS_HOUSE isn't the right location create an area where yours is. 1 Quote Link to comment Share on other sites More sharing options...
UkBenH Posted October 17, 2020 Author Share Posted October 17, 2020 2 hours ago, Gunman said: My guess is it's getting stuck because of web walking. Web walking by default will complete if a tile off. But I would just change the position to an area which I think the same area you're walking to is in the Banks API. I would probably restructure it like this private void handleBank() throws InterruptedException { if (getBank().isOpen()) { currentState = "Depositing"; if (getBank().depositAll()) { Sleep.sleepUntil(() -> getInventory().isEmpty(), 4000); } } else if (!getBank().open()) { currentState = "Navigating to bank"; getWalking().webWalk(Banks.HOSIDIUS_HOUSE); } } And the first if in the onLoop I would change to just this if (getInventory().isFull()) { handleBank(); } If Banks.HOSIDIUS_HOUSE isn't the right location create an area where yours is. Thank you - this helped! 1 Quote Link to comment Share on other sites More sharing options...
ExtraBotz Posted October 17, 2020 Share Posted October 17, 2020 10 minutes ago, UkBenH said: Thank you - this helped! In addition to what @Gunman said you can do .getRandomPosition() so that when walking to the bank it will be random every time. getWalking().webWalk(Banks.HOSIDIUS_HOUSE.getRandomPosition()); You can also use the Bank class to open the bank with a method called .open(). You can read more about that here in the OSBot API Docs. Quote Searches for the best bank, based on type and distance from player. This method will only interact with RS2Objects. 2 Quote Link to comment Share on other sites More sharing options...
UkBenH Posted October 18, 2020 Author Share Posted October 18, 2020 3 hours ago, ExtraBotz said: In addition to what @Gunman said you can do .getRandomPosition() so that when walking to the bank it will be random every time. getWalking().webWalk(Banks.HOSIDIUS_HOUSE.getRandomPosition()); You can also use the Bank class to open the bank with a method called .open(). You can read more about that here in the OSBot API Docs. Thank you. I literally just knew how to change the areas it was using; but I'm trying to pick things up. Appreciate your comment. Quote Link to comment Share on other sites More sharing options...