mousbros Posted March 11, 2020 Share Posted March 11, 2020 it seems it doesnt know the depositbox is open, it just closes the bank again and tries to bank againd without depositing. thanks guys in advance case "BANKING": final Area BANKING_AREA = new Area (3044,3233,3050,3236); if(BANKING_AREA.contains(myPosition())){ Entity depobox = objects.closest("Bank deposit box"); if (depobox != null) { sleep(random(757,2345)); if (depobox.interact("Deposit")) { if (depositBox.isOpen()) { log("Try opening bank"); depositBox.depositAllExcept("Bronze pickaxe"); } } } } break; Quote Link to comment Share on other sites More sharing options...
agentcallooh Posted March 11, 2020 Share Posted March 11, 2020 (edited) You should separate out the is-open and is-not-open logic so that when onLoop runs again your script can take appropriate action. if (depobox.isOpen()) { depobox.depositAllExcept("Bronze pickaxe"); } else { depobox.interact("Deposit"); } Edited March 11, 2020 by agentcallooh 2 Quote Link to comment Share on other sites More sharing options...
mousbros Posted March 11, 2020 Author Share Posted March 11, 2020 2 minutes ago, agentcallooh said: You should separate out the is-open and is-not-open logic so that when onLoop runs again your script can take appropriate action. if (depositBox.isOpen()) { depositBox.depositAllExcept("Bronze pickaxe"); } else { depobox.interact("Deposit"); } legend Quote Link to comment Share on other sites More sharing options...
Gunman Posted March 11, 2020 Share Posted March 11, 2020 @mousbros Why not use the depsoitBox API method open to open the depositbox? Also to expand off what Agentcallooh said if (getDepositBox().isOpen()) { if (getDepositBox().depositAllExcept("Bronze pickaxe")) { //sleep } } else if (getDepositBox().open()) { //sleep till open } else { //walk to deposit box area } I would do it like this^ If the box is open it will go to the next if and only if that boolean returns true will it sleep. So it doesn't sleep for 10 seconds or whatever if the action failed. Continue to the else if statement, the API method will look and see if there is a deposit box nearby to attempt to open it. If it does it will then continue to the sleep or whatever you wanna do after. Else walk to the box. 1 Quote Link to comment Share on other sites More sharing options...