kingbutton Posted July 31, 2017 Posted July 31, 2017 Title tells it all. I'm using bank.getItem("String") My code opens the bank, but it just closes it without grabbing what I need, and just repeats itself. if (!inventory.contains("Small fishing net")) { if(banker.isVisible()) { camera.toEntity(banker); banker.interact("Bank"); sleep(random(700,1000)); bank.getItem("Small fishing net"); sleep(random(500,1000)); } else { getWalking().walk(bank_location); } I'm not sure if I'm using sleep properly by the way. Could somebody also explain why sleep is needed?
Juggles Posted July 31, 2017 Posted July 31, 2017 bank.getItem("Small fishing net"); That does not withdraw an item getBank.withdraw("item", amount); Also check if bank is open before withdrawing 1
Deceiver Posted July 31, 2017 Posted July 31, 2017 if (!getInventory().contains("Small fishing net")) { if (banker != null && banker.exists) { if (banker.isVisible()) { banker.interact("Bank"); new ConditionalSleep(5000) { // ConditionalSleep will sleep for 5 seconds or until the bank is open public boolean condition() { return getBank().isOpen(); } }.sleep(); bank.withdraw(1, "Small fishing net"); new ConditionalSleep(5000) { public boolean condition() { return getInventory().contains("Small fishing net"); } }.sleep() } else { getWalking().walk(bank_location); } there might be a few missing brackets }, but u can just add those in
Charlotte Posted July 31, 2017 Posted July 31, 2017 getItems(), would get array of items stored in the container. In this case, you should be using withdraw(). 1
kingbutton Posted July 31, 2017 Author Posted July 31, 2017 10 minutes ago, Charlotte said: getItems(), would get array of items stored in the container. In this case, you should be using withdraw(). derp, thanks bruv. 15 minutes ago, Juggles said: bank.getItem("Small fishing net"); That does not withdraw an item getBank.withdraw("item", amount); Also check if bank is open before withdrawing Thanks, I just started to learn to code. I'm not sure what kind of checks I should be doing, there's a lot to think about - _ -
Viston Posted July 31, 2017 Posted July 31, 2017 50 minutes ago, kingbutton said: derp, thanks bruv. Thanks, I just started to learn to code. I'm not sure what kind of checks I should be doing, there's a lot to think about - _ - It's mostly logic. If you were playing and want to withdraw something from the bank, wouldn't you first wait for the bank to open before withdrawing something? That's how it goes