cjeee Posted March 27, 2015 Share Posted March 27, 2015 (edited) EDIT; Guys, I still need help, please scroll down and help me please so what im trying to do is return a state for banking once the inventory becomes full and the same thing for if its empty even tho its containing 2 different items, here is my code private enum State { ERROR, WALKBACK, BANK, WAIT, }; private State getState() { if (!inventory.contains(563) || !equipment.contains(1381)) { log("State ERROR returned"); return State.ERROR; } } if (inventory.isEmptyExcept(563, 555) || inventory.isEmptyExcept(563)) { log("State WALKBACK returned"); return State.WALKBACK; } if (inventory.isFull()) { log("State BANK returned"); return State.BANK; } return State.WAIT; } idk if im doing this right but shouldnt it log out my text if my inventory is full/isEmptyExcept(xx)? its not working but all of my other getStates are working just fine so im obviously missing something or using the wrong methods Edited March 28, 2015 by cjeee Quote Link to comment Share on other sites More sharing options...
Isolate Posted March 27, 2015 Share Posted March 27, 2015 so what im trying to do is return a state for banking once the inventory becomes full and the same thing for if its empty even tho its containing 2 different items, here is my code isEmptyExcept(); is broken. A fix along the lines of: boolean inventoryEmptyExcept(final int...ints){ return !inventory.contains(new Filter<Item>() { @Override public boolean match(Item item) { return item != null && !Arrays.asList(ints).contains(item.getId()); } }); } Could be edited to strings ect Quote Link to comment Share on other sites More sharing options...
cjeee Posted March 27, 2015 Author Share Posted March 27, 2015 (edited) isEmptyExcept(); is broken. A fix along the lines of: boolean inventoryEmptyExcept(final int...ints){ return !inventory.contains(new Filter<Item>() { @Override public boolean match(Item item) { return item != null && !Arrays.asList(ints).contains(item.getId()); } }); } Could be edited to strings ect Im getting these errors in my code when i put them in: "The method contains(List<Item>) in the type ItemContainer is not applicable for the arguments (new Filter<Item>(){})" Also getting an error under "match(Item item) public boolean match(Item item) "The method match(Item) of type new Filter<Item>(){} must override or implement a supertype method" im sorry i am a noob at this but im always willing to learn! EDIT: I added the import and im getting a warning message under all of the code you send me now "Type safety: A generic array of Filter<Item> is created for a varargs parameter" Edited March 27, 2015 by cjeee Quote Link to comment Share on other sites More sharing options...
Isolate Posted March 27, 2015 Share Posted March 27, 2015 import org.osbot.rs07.api.filter.Filter; import org.osbot.rs07.api.model.Item; import java.util.Arrays; these ones? Quote Link to comment Share on other sites More sharing options...
cjeee Posted March 28, 2015 Author Share Posted March 28, 2015 (edited) import org.osbot.rs07.api.filter.Filter; import org.osbot.rs07.api.model.Item; import java.util.Arrays; these ones? yessir! EDIT: When i added the code: if (inventoryEmptyExcept(563, 555) || inventoryEmptyExcept(563)) { log("State WALKBACK returned"); return State.WALKBACK; } along with the warning below, i still don't receive a log back when those conditions are met. can somebody please help me? Edited March 11, 2016 by cjeee Quote Link to comment Share on other sites More sharing options...