Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Inventory contains all items

Featured Replies

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!

You could do something like

String[] ITEMS = ....

for(String item : ITEMS)

   if(!inventory.contains(item))

        return false



return true;

 

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!

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
}

 

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 by Reveance

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.