Eagle Scripts Posted April 23, 2015 Posted April 23, 2015 So I'm trying to let my script deposit all except *something*, if in the deposit box's area.It opens the deposit box, so that's good.It doesn't deposit all except *something*, it deposits everythingEven though i'm telling it to deposit except certain items, so this is why I'm asking for help what I should do so it deposits all but certain items.My code so far : case BANK: if (inventory.isFull() && BANK_AREA.contains(myPlayer())); Entity BANK = objects.closest("Bank deposit box"); log("Bank deposit box null?: " + (BANK == null)); log("Bank deposit box has Deposit action: " + BANK.hasAction("Deposit")); if (!depositBox.isOpen()) { if (depositBox != null) { if (depositBox.open()) sleep(random(1000, 3000)); } } else if (!inventory.isEmpty()) { if (depositBox.depositAllExcept("Lobster pot, Coins, coins, Harpoon")) sleep(1000); } Thanks in advance,
Flamezzz Posted April 23, 2015 Posted April 23, 2015 (edited) depositBox.depositAllExcept("Lobster pot", "Coins", "coins", "Harpoon") It takes an array (or varargs) of strings Also: if (!depositBox.isOpen()) { if (depositBox != null) { if (depositBox.open()) sleep(random(1000, 3000)); } } depositBox won't be null if you successfully called depositBox.isOpen() right? depositBox.open() checks if it's already open, so no need to double check that Edited April 23, 2015 by Flamezzz
Eagle Scripts Posted April 23, 2015 Author Posted April 23, 2015 (edited) depositBox.depositAllExcept("Lobster pot", "Coins", "coins", "Harpoon") It takes an array (or varargs) of strings Also: if (!depositBox.isOpen()) { if (depositBox != null) { if (depositBox.open()) sleep(random(1000, 3000)); } } depositBox won't be null if you successfully called depositBox.isOpen() right? depositBox.open() checks if it's already open, so no need to double check that So what would the new full case bank be? Edited April 23, 2015 by ragfr00b
Flamezzz Posted April 23, 2015 Posted April 23, 2015 I think something like this would work if (BANK_AREA.contains(myPlayer())) { if(inventory.isFull()) { // We do not assume open always succeeds if(depositBox.open()) { depositBox.depositAllExcept("Lobster pot", "Coins", "coins", "Harpoon"); } } else { // deposited stuff, now walk somewhere? } } 1