December 14, 20169 yr 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 December 14, 20169 yr by Hayase
December 14, 20169 yr 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 } }
Create an account or sign in to comment