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.

Checking to see if an item in your inventory has a certain action?

Featured Replies

I saw that itemcontainer had a method for .hasAction() which was what I was looking for, but no matter what I tried, it kept giving me an error.

I saw that itemcontainer had a method for .hasAction() which was what I was looking for, but no matter what I tried, it kept giving me an error.

 

What action are you looking for?

 

I know that item.interact returns a boolean so you can basically check if it happened, and if it doesnt do nothing or something.

  • Author

What action are you looking for?

 

I know that item.interact returns a boolean so you can basically check if it happened, and if it doesnt do nothing or something.

 

Does it really? I think that pretty much solves this then. I just need to check if an item has a certain action, and if it doesn't then don't bother doing anything with this item.

 

Lol it does, I really didn't know that. Pretty sure that should fix this then. Thanks a lot :)

Edited by twin 763

Does it really? I think that pretty much solves this then. I just need to check if an item has a certain action, and if it doesn't then don't bother doing anything with this item.

 

Lol it does, I really didn't know that. Pretty sure that should fix this then. Thanks a lot smile.png

 

http://osbot.org/api/org/osbot/rs07/api/model/Item.html#hasAction%28java.lang.String...%29

 

Check this out also, Item has a hasAction method

I didn't even see this post lol. I just did if(inventory.interact("View","Looting bag")!=false) and it works, I not needed to check one item. I just didn't know that returned a Boolean.

 

haha

 

Well, probem solved :D

Twin do not use != false

If you do

If (boolean) <-- its already checking to see if its true.

If (!boolean) <-- false check

  • Author

Twin do not use != false

If you do

If (boolean) <-- its already checking to see if its true.

If (!boolean) <-- false check

That's what I did sorry :p. I just got up when I wrote that wasn't thinking lol.

At least I think I did. I might have to check my code when I get home. :o

Edited by twin 763

Next time you say you get an "error" you should include the exception stack trace as well so we can help you pinpoint the exact location and cause of the problem very quickly.

  • Author

Next time you say you get an "error" you should include the exception stack trace as well so we can help you pinpoint the exact location and cause of the problem very quickly.

I was just getting cannot make a static call to a non static reference but that's because I was using the wrong code. Like I said, I just didn't know inventory.interact returned as Boolean.

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.