Jump to content

Examining local objects/things with examine options


Recommended Posts

Posted (edited)
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
Posted


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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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