December 4, 20241 yr I'm having trouble obtaining RS2Objects around my character which contain the Examine action. I use the following line to try to do so, yet its size is always 0. I am trying to examine things like trees and whatnot. List<RS2Object> objectsNearby = mp.getObjects().filter(o -> o.hasAction("Examine"));
December 5, 20241 yr It will be something like: RS2Object nearestExaminableObject = getObjects().closest(a -> a.hasAction("Examine") && a.getPosition().distance(myPosition()) <= 7); if (nearestExaminableObject != null) { nearestExaminableObject.interact("Examine"); } else { log("Waiting until an examinable object is nearby"); }
December 5, 20241 yr Author 1 hour ago, Czar said: It will be something like: RS2Object nearestExaminableObject = getObjects().closest(a -> a.hasAction("Examine") && a.getPosition().distance(myPosition()) <= 7); if (nearestExaminableObject != null) { nearestExaminableObject.interact("Examine"); } else { log("Waiting until an examinable object is nearby"); } Thanks! I see you've called .closest() which only returns a single RS2Object. I was hoping to obtain a List of them all. Do you know if such a thing is possible? Edited December 5, 20241 yr by bobbybill123
December 5, 20241 yr Author Oddly enough, even the simple call getObjects().closest(a -> a.hasAction("Examine")); returns null despite being surrounded by trees with examine text.
December 6, 20241 yr On 12/5/2024 at 4:38 AM, bobbybill123 said: Oddly enough, even the simple call getObjects().closest(a -> a.hasAction("Examine")); returns null despite being surrounded by trees with examine text. To get a list you need to collect the objects like so List<RS2Object> objectsNearby = mp.getObjects().stream().filter(o -> o.hasAction("Examine")).collect(Collectors.toList());
December 6, 20241 yr Author 13 hours ago, DCHILLING said: To get a list you need to collect the objects like so List<RS2Object> objectsNearby = mp.getObjects().stream().filter(o -> o.hasAction("Examine")).collect(Collectors.toList()); I have tried List<RS2Object> nearbyObjects = mp.getObjects().getAll().stream().filter(o -> o.hasAction("Examine")).collect(Collectors.toList()); but this too returns an empty list.
December 6, 20241 yr Author Solved this. It looks like "Examine" is not an action found in RS2Objects.
Create an account or sign in to comment