Lexhanatin Posted November 19, 2016 Posted November 19, 2016 (edited) SOLVED THANKES TO Juggles__________________________________________________________________________________________________________ I'm making a script that involves checking the amount of coins a player has in their inventory. At the moment it doesn't do anything. It doesn't even open the bank.Here is my code case BANK: if (!getBank().isOpen()){ getBank().open(); } else if (inventory.getAmount("Coins") < 500) { getBank().withdrawAll("Coins"); } else { getBank().close(); } break; It's pretty similar to this, so I'm not sure what I'm doing wrong. http://osbot.org/forum/topic/68196-get-the-amount-of-items-in-inventory/ Thanks. Edited November 19, 2016 by Lexhanatin 1
Explv Posted November 19, 2016 Posted November 19, 2016 I'm making a script that involves checking the amount of coins a player has in their inventory. At the moment it doesn't do anything. It doesn't even open the bank. Here is my code case BANK: // If inventory contains less than 500 coins, withdraw coins if (inventory.getAmount("Coins") < 500) { getBank().withdrawAll("Coins"); } else { getBank().close(); } break; It's pretty similar to this, so I'm not sure what I'm doing wrong. http://osbot.org/forum/topic/68196-get-the-amount-of-items-in-inventory/ Thanks. You need to open the bank first. if (getBank() == null) { // walk to bank } else if (!getBank().isOpen()) { if (getBank().open()) { new ConditionalSleep(5000) { @ Override public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); } } else { getBank().withdrawAll("Coins"); }
Lexhanatin Posted November 19, 2016 Author Posted November 19, 2016 because you need to use getBank().open() ? I had that already, I just forgot to add it into the code example. Sorry.
Juggles Posted November 19, 2016 Posted November 19, 2016 Check your state. It's probably not calling the case 2
Lexhanatin Posted November 19, 2016 Author Posted November 19, 2016 Check your state. It's probably not calling the case Thank you so much. You were right. 1