Twin Posted May 4, 2015 Share Posted May 4, 2015 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. Quote Link to comment Share on other sites More sharing options...
Tom Posted May 4, 2015 Share Posted May 4, 2015 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. Quote Link to comment Share on other sites More sharing options...
Twin Posted May 4, 2015 Author Share Posted May 4, 2015 (edited) 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 May 4, 2015 by twin 763 Quote Link to comment Share on other sites More sharing options...
Tom Posted May 4, 2015 Share Posted May 4, 2015 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 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 Quote Link to comment Share on other sites More sharing options...
Twin Posted May 4, 2015 Author Share Posted May 4, 2015 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 inventory.interact worked, I just didnt' know it returned a boolean lol. Thanks again for the help. Quote Link to comment Share on other sites More sharing options...
Psvxe Posted May 4, 2015 Share Posted May 4, 2015 http://osbot.org/forum/topic/71528-how-to-filter-inventory-items-that-only-contains-a-certein-action/ You could use this too perhaps. Quote Link to comment Share on other sites More sharing options...
Twin Posted May 4, 2015 Author Share Posted May 4, 2015 http://osbot.org/forum/topic/71528-how-to-filter-inventory-items-that-only-contains-a-certein-action/ You could use this too perhaps. 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. Quote Link to comment Share on other sites More sharing options...
Psvxe Posted May 4, 2015 Share Posted May 4, 2015 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 Quote Link to comment Share on other sites More sharing options...
Joseph Posted May 4, 2015 Share Posted May 4, 2015 Twin do not use != false If you do If (boolean) <-- its already checking to see if its true. If (!boolean) <-- false check Quote Link to comment Share on other sites More sharing options...
Twin Posted May 4, 2015 Author Share Posted May 4, 2015 (edited) 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. Edited May 4, 2015 by twin 763 Quote Link to comment Share on other sites More sharing options...
lare96 Posted May 4, 2015 Share Posted May 4, 2015 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. Quote Link to comment Share on other sites More sharing options...
Twin Posted May 6, 2015 Author Share Posted May 6, 2015 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. Quote Link to comment Share on other sites More sharing options...