March 30, 20178 yr I know the API has: inventory.contains(); However this will return true as long as 1 item from the selected exists. I want to confirm that the inventory contains all of the items however. What's the best way to do this rather than a statement for each item? Thanks for your help!
March 30, 20178 yr You could do something like String[] ITEMS = .... for(String item : ITEMS) if(!inventory.contains(item)) return false return true;
March 30, 20178 yr https://osbot.org/api/org/osbot/rs07/api/util/ItemContainer.html#onlyContains-org.osbot.rs07.api.filter.Filter...- https://osbot.org/api/org/osbot/rs07/api/util/ItemContainer.html#onlyContains-int...- https://osbot.org/api/org/osbot/rs07/api/util/ItemContainer.html#onlyContains-java.lang.String...- edit: yeah confirmed by @Diclonius, above is not what you're looking for :c Edited March 30, 20178 yr by Stimpack
March 30, 20178 yr 2 minutes ago, Stimpack said: https://osbot.org/api/org/osbot/rs07/api/util/ItemContainer.html#onlyContains-org.osbot.rs07.api.filter.Filter...- Not even close.
March 30, 20178 yr 1 minute ago, Stimpack said: https://osbot.org/api/org/osbot/rs07/api/util/ItemContainer.html#onlyContains-org.osbot.rs07.api.filter.Filter...- I believe he's asking for a method for checking if the inventory contains all items, and possibly any others. This methods checks if the inventory contains all the items and no others.
March 30, 20178 yr 2 minutes ago, Diclonius said: I believe he's asking for a method for checking if the inventory contains all items, and possibly any others. This methods checks if the inventory contains all the items and no others. yeah i just noticed!
April 2, 20178 yr On 3/30/2017 at 10:09 AM, Polymorphism said: You could do something like String[] ITEMS = .... for(String item : ITEMS) if(!inventory.contains(item)) return false return true; No need for external object to store data simply call as the following instead, you also can call Strings instead as well rather than pull the ids. if (getInventory().contains(1042, 1050, 11694)) { // do stuff }
April 2, 20178 yr 14 hours ago, Booleans YAY said: No need for external object to store data simply call as the following instead, you also can call Strings instead as well rather than pull the ids. if (getInventory().contains(1042, 1050, 11694)) { // do stuff } Read the OP, this is not the same behaviour as the code the post you quoted contains. And the OP literally said the method you posted doesn't do what he needs. Edited April 2, 20178 yr by Reveance
Create an account or sign in to comment