Jump to content

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


Twin

Recommended Posts

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...