Jump to content

Examining local objects/things with examine options


Hayase
 Share

Recommended Posts

List local_objects = api.objects.getAll();
int size = local_objects.size();

for (int i = 0; i < size - 1; i++) {
    Entity _object = (Entity) local_objects.get(i);
    if (_object.isVisible()) {
        if (_object.hasAction("Examine")) {
            _object.interact("Examine");
            break;
        }
    }
}

I'm trying to grab all local objects and then sort through them to see which objects can be examined. After that it should examine the found object.

 

This doesn't work though. It doesn't seem to work at all. Does anyone have advice how I can populate local objects and then figure out which ones can be examined?

 

All the best,

Edited by Hayase
Link to comment
Share on other sites


RS2Object object = api.getObjects().get(o -> o.hasAction("Examine"));

//Make sure to null check it too before you use it.

//If you need a collection you can just do

RS2Object[] / List<RS2Object> objectList = api.getObjects().getAll();

for(RS2Object object : objectList){

if(object != null && object.hasAction("Examine")){

object.interact("Examine");

//sleep here probably

}

}

  • Like 1
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.

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.

 Share

  • Recently Browsing   0 members

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