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.

getInventory.contains problems

Featured Replies

Hello,

For some reason this keeps logging 2 while I'm 100% sure I got a Wooden shield in my inventory...

Quote

public boolean woodenShieldInBotInv() {        
        if (phreeBot.getInventory().contains("Wooden shield")) {
            phreeBot.log("1");
            return true;
        } else {
            phreeBot.log("2");
        }
        return false;
    }

 

What am I doing wrong? When I create a new project with the same code it just works however in my existin project it doesn't when it used to work just right. Before asking what all my other code is, does that matter? 

It's probably not related to the code if creating a new project with the same code makes it work

  • Author
2 minutes ago, Token said:

It's probably not related to the code if creating a new project with the same code makes it work

Then what makes it go wrong?

Just now, Phree said:

Then what makes it go wrong?

I guess wrong project setup, not building the script jar properly, many other things

  • Author

When I put this on the top of my OnLoop out of the function and before executing any other code it still logs 2.

Try putting the code directly into the OnLoop without using your phreeBot call just do getInventory().contains(name) 

If that works than it might be how your setting the phreeBot var.

Edited by BravoTaco

  • Author
24 minutes ago, BravoTaco said:

Try putting the code directly into the OnLoop without using your phreeBot call just do getInventory().contains(name) 

If that works than it might be how your setting the phreeBot var.

I did this and it still logs 2.

Very interesting. Might be as token said. You could get all the items in the inventory and see if it detects any items at all.

getInventory.getItems() - returns item array, i think 🙂

Loop through that and log the name of the items.

Edited by BravoTaco

  • Author

Thanks all. Very strange but I just got back and run the script and now everything works as before.

 

Spooky.

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.