shaba123 Posted May 12, 2023 Posted May 12, 2023 if (api.bank !=null) { try { api.bank.open(); } catch (InterruptedException e) { throw new RuntimeException(e); } } else { api.walking.webWalk(Banks.LUMBRIDGE_UPPER); }
Czar Posted May 12, 2023 Posted May 12, 2023 api.bank will never be null, so the code will just be trying to call api.bank.open() 24/7 even if its away from a bank. api.bank is the reference to the osbot's bank class (which holds all functions like bank.open, bank.close, bank.withdraw) you must replace the api.bank != null line with a way to check if we're near a bank, so you can do if (getNpcs().closest("Banker") != null) { as an example, of course the best way is to have a list of banks and check if distance is < 15 to any of the banks in the list. 1
Gunman Posted May 12, 2023 Posted May 12, 2023 You could do what Czar said or you can just do if (!api.bank.open()) { api.walking.webWalk(Banks.LUMBRIDGE_UPPER); } 1