Lewis Posted November 20, 2016 Posted November 20, 2016 (edited) i am looking to withdraw items A, B, C, D, E from the bank for example. what would be the best way to do this? would i check individually for each item i.e if A is in bank withdraw A If B is in bank withdraw B etc or would i be able to do a list for example: if Items is in bank withdraw Items Edit: i want to withdraw ALL not X/all but one etc Edited November 20, 2016 by Lewis
Eagle Scripts Posted November 20, 2016 Posted November 20, 2016 You could maybe try to loop through the items in a for loop by making a list/array and loop through every item in that list/array
Lewis Posted November 20, 2016 Author Posted November 20, 2016 (edited) You could maybe try to loop through the items in a for loop by making a list/array and loop through every item in that list/array could you give me a code example please? ArrayList listTest = new ArrayList( listTest.add( "first item" ); listTest.add( "second item" ); listTest.add( "third item" ); listTest.add( "fourth item" ); for example Edited November 20, 2016 by Lewis
Eagle Scripts Posted November 20, 2016 Posted November 20, 2016 (edited) could you give me a code example please? ArrayList listTest = new ArrayList( listTest.add( "first item" ); listTest.add( "second item" ); listTest.add( "third item" ); listTest.add( "fourth item" ); for example Send me a message on skype Edited November 20, 2016 by Eagle Scripts
Lewis Posted November 20, 2016 Author Posted November 20, 2016 Send me a message on skype thank you, not on skype currently but ill be on soon
Lordsthan Posted November 21, 2016 Posted November 21, 2016 (edited) You can try: array items if the bank is open: loop through items if the bank contains items[x] and inventory does not: withdraw item[x] else continue/stop else if the bank is not open and my player is near the bank: open bank else go to the bank Edited November 21, 2016 by Lordsthan
Bamboozled Posted November 21, 2016 Posted November 21, 2016 still needing help with this if(getBank().isOpen()){ if (getBank().contains("itemA")) { getBank().withdraw("itemA", 5); //Will withdraw 5 of Item A } if (getBank().contains("itemB")) { getBank().withdrawAll("ItemB"); //will withdraw ALL of Item B } if (getBank().contains("itemC")) { getBank().withdraw("itemC", 5); //Will withdraw 5 of Item C } if (getBank().contains("itemD")) { getBank().withdrawAll("ItemD"); //will withdraw ALL of Item D } } --This might not be the best way but hope it can help!
PlagueDoctor Posted November 21, 2016 Posted November 21, 2016 (edited) I'd imagine its possible to make a list or array work, but straight up use won't work. EDIT: Adding in failsafes to what i've written below would be an improvement, if statements like how bamboozled wrote it is a step in the right direction. private String items[] = new String[] {"Death rune", "Nature rune", "Battlestaff", }; bank.withdrawAll(items); // this won't work. /////////////////////////////////////////////////////////////////////////// This is how i would write it. getBank().enableMode(Bank.BankMode.WITHDRAW_NOTE); bank.withdrawAll(A); new ConditionalSleep(10000) { @[member='Override'] public boolean condition() throws InterruptedException { return inventory.contains(A); } }.sleep(); bank.withdrawAll(B); new ConditionalSleep(10000) { @[member='Override'] public boolean condition() throws InterruptedException { return inventory.contains(B); } }.sleep(); bank.withdrawAll(C); new ConditionalSleep(10000) { @[member='Override'] public boolean condition() throws InterruptedException { return inventory.contains(C); } }.sleep(); Edited November 21, 2016 by PlagueDoctor
liverare Posted November 21, 2016 Posted November 21, 2016 To get you started: // Google "ArrayList" List<String> itemNames = new ArrayList<>(); // Add items to ArrayList itemNames.add("nature rune"); itemNames.add("dragon dagger"); // Use Lambda expressions to loop through list and withdraw items // (e) is the individual (e)lement of the list itemNames.forEach((e) -> bank.withdrawAll(e)); There's NO validation in this. It's a simple assumption-based botting; we're assuming we'll be able to withdraw each item.
Juggles Posted November 21, 2016 Posted November 21, 2016 (edited) if(getBank().isOpen()){ if (getBank().contains("itemA")) { getBank().withdraw("itemA", 5); //Will withdraw 5 of Item A } if (getBank().contains("itemB")) { getBank().withdrawAll("ItemB"); //will withdraw ALL of Item B only if A is already withdrawn } if (getBank().contains("itemC")) { getBank().withdraw("itemC", 5); //Will withdraw 5 of Item C only if A and B are already withdrawn. } if (getBank().contains("itemD")) { getBank().withdrawAll("ItemD"); //will withdraw ALL of Item D only if A,B, and C are already withdrawn. } } --This might not be the best way but hope it can help! Would be better to do else if instead of just using an if else if causes the previous step to become false until it moves onto the next step. Example: if (getBank().contains("itemA")) { getBank().withdraw("itemA", 5); //Will withdraw 5 of Item A } else if (getBank().contains("itemB")) { getBank().withdrawAll("ItemB"); //will withdraw ALL of Item B }else if (getBank().contains("itemC")) { getBank().withdraw("itemC", 5); //Will withdraw 5 of Item C }else if (getBank().contains("itemD")) { getBank().withdrawAll("ItemD"); //will withdraw ALL of Item D } Edited November 21, 2016 by Juggles 1