Ayylmao420 Posted July 2, 2016 Share Posted July 2, 2016 1. OSBot Version - 2.4.71 2. A description of the issue - Issue 1 - GroundItem groundItem = getObjects().closest(gI -> gI.getName().equals("Bones") && gI.hasAction("Take")); It doesn't find any items, the issue here is gI.hasAction("Take")), if i remove it, it finds the bones. Issue 2 - groundItem .isVisible() sometimes returns false even though it is visible 3. Are you receiving any errors in the client canvas or the logger? - 4. How can you replicate the issue? above 5. Has this issue persisted through multiple versions? If so, how far back? No ideas Link to comment Share on other sites More sharing options...
Alek Posted July 2, 2016 Share Posted July 2, 2016 Not a client bug, moving to scripting help. Link to comment Share on other sites More sharing options...
Token Posted July 2, 2016 Share Posted July 2, 2016 GroundItem groundItem = getObjects().closest(gI -> gI.getName().equals("Bones") && gI.hasAction("Take")); You have a GroundItem object on the left side and a RS2Object on the right side Checking for "Take" action however is redundant as by definition every GroundItem has the "Take" action, just like every Player has the "Follow" action Link to comment Share on other sites More sharing options...
ikk Posted July 2, 2016 Share Posted July 2, 2016 Precisely what Token said above. you're defining your groundItem by doing getObjects() which is returning an RS2Object. You should instead, do getGroundItems().closest(gI -> gI != null && gI.getName().equals("Bones")) Something I also do to avoid the issue with isVisible() not returning the expected value is to do both isVisible() && isOnScreen() Link to comment Share on other sites More sharing options...
Ayylmao420 Posted July 2, 2016 Author Share Posted July 2, 2016 (edited) GroundItem groundItem = getObjects().closest(gI -> gI.getName().equals("Bones") && gI.hasAction("Take")); You have a GroundItem object on the left side and a RS2Object on the right side Checking for "Take" action however is redundant as by definition every GroundItem has the "Take" action, just like every Player has the "Follow" action Sorry, my bad, i had it declared as getGroundItems().closestst() just a typo! Just wanted to have action checks because of my ocd :p Precisely what Token said above. you're defining your groundItem by doing getObjects() which is returning an RS2Object. You should instead, do getGroundItems().closest(gI -> gI != null && gI.getName().equals("Bones")) Something I also do to avoid the issue with isVisible() not returning the expected value is to do both isVisible() && isOnScreen() So using isVisible() && isOnScreen() at once should fix the issue ? Edited July 2, 2016 by Ayylmao420 Link to comment Share on other sites More sharing options...
ikk Posted July 2, 2016 Share Posted July 2, 2016 So using isVisiböe() && isOnScreen() at once should fix the issue ? I haven't ran into any problems with using both of those in conjunction. Be sure to also include a null check. But I wouldn't say it is required that you check if it's visible while trying to find the ground item. I prefer to do: check if ground item is within ~8 tiles of me && My character can physically reach that item without any doors / obstacles in the way. Now that you have the close-ish, reachable groundItem, then you can check if it's visible. The benefit, in my opinion, of doing it this way, is that you now have the ability to move the camera to the item if it wasn't previously visible. Link to comment Share on other sites More sharing options...
Ayylmao420 Posted July 2, 2016 Author Share Posted July 2, 2016 I haven't ran into any problems with using both of those in conjunction. Be sure to also include a null check. But I wouldn't say it is required that you check if it's visible while trying to find the ground item. I prefer to do: check if ground item is within ~8 tiles of me && My character can physically reach that item without any doors / obstacles in the way. Now that you have the close-ish, reachable groundItem, then you can check if it's visible. The benefit, in my opinion, of doing it this way, is that you now have the ability to move the camera to the item if it wasn't previously visible. But is there any specific reason why isVisible() would retun false sometimes ? Isn't it considered as a bug ? Link to comment Share on other sites More sharing options...
ikk Posted July 2, 2016 Share Posted July 2, 2016 (edited) But is there any specific reason why isVisible() would retun false sometimes ? Isn't it considered as a bug ? I think it depends on what the API means by visible. I've not looked into the code myself, but I noticed that sometimes if the item technically is clickable, there may be other objects in the way obstructing the full visibility of the entity, which will cause isVisible() to return false. But that's just from observation, I really don't know how the method is intended to work. Edited July 2, 2016 by ikk Link to comment Share on other sites More sharing options...
Ayylmao420 Posted July 2, 2016 Author Share Posted July 2, 2016 I think it depends on what the API means by visible. I've not looked into the code myself, but I noticed that sometimes if the item technically is clickable, there may be other objects in the way obstructing the full visibility of the entity, which will cause isVisible() to return false. But that's just from observation, I really don't know how the method is intended to work. Not a client bug, moving to scripting help. Can you look into this Alek ? Link to comment Share on other sites More sharing options...
Alek Posted July 2, 2016 Share Posted July 2, 2016 Since you told me this was fixed, don't blame novice scripting questions as client bugs again. It wastes a lot of my time. 1 Link to comment Share on other sites More sharing options...