Hayase Posted December 14, 2016 Share Posted December 14, 2016 (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 December 14, 2016 by Hayase Quote Link to comment Share on other sites More sharing options...
LoudPacks Posted December 14, 2016 Share Posted December 14, 2016 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 } } 1 Quote Link to comment Share on other sites More sharing options...
Alek Posted December 14, 2016 Share Posted December 14, 2016 Nice casting; also use Java conventions. 1 Quote Link to comment Share on other sites More sharing options...