elemt Posted September 20, 2015 Share Posted September 20, 2015 How can I get a list or array of InteractableObjects that are around my player? Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted September 20, 2015 Share Posted September 20, 2015 List<RS2Object> objects = getObjects().getAll(); Quote Link to comment Share on other sites More sharing options...
Joseph Posted September 20, 2015 Share Posted September 20, 2015 up above returns a list of items that are in your region. Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted September 20, 2015 Share Posted September 20, 2015 List<RS2Object> objects = getObjects().getAll(); this^ but this will also return eveyr single object thats not interactble. Like walls, fences and bllablabla These walls, fences ... names are always "null". Might want to filter those out ^^ Khaleesi Quote Link to comment Share on other sites More sharing options...
FrostBug Posted September 20, 2015 Share Posted September 20, 2015 import org.osbot.rs07.api.filter.Filter; import org.osbot.rs07.api.model.InteractableObject; import org.osbot.rs07.api.model.RS2Object; /** * Get InteractableObjects * @author FrostBug */ public class InteractableFilter implements Filter<RS2Object> { @Override public boolean match(RS2Object v) { return v instanceof InteractableObject; } } List<RS2Object> interactableObjs = getObjects().filter(new InteractableFilter()); 2 Quote Link to comment Share on other sites More sharing options...
fixthissite Posted September 20, 2015 Share Posted September 20, 2015 (edited) import org.osbot.rs07.api.filter.Filter;import org.osbot.rs07.api.model.InteractableObject;import org.osbot.rs07.api.model.RS2Object;/** * Get InteractableObjects * @author FrostBug */public class InteractableFilter implements Filter<RS2Object> { @Override public boolean match(RS2Object v) { return v instanceof InteractableObject; } }List<RS2Object> interactableObjs = getObjects().filter(new InteractableFilter());Or just List<RS2Object> interactableObjs = getObjects().filter(o -> o instanceof InteractableObject); Edited September 20, 2015 by fixthissite 1 Quote Link to comment Share on other sites More sharing options...
elemt Posted September 21, 2015 Author Share Posted September 21, 2015 import org.osbot.rs07.api.filter.Filter; import org.osbot.rs07.api.model.InteractableObject; import org.osbot.rs07.api.model.RS2Object; /** * Get InteractableObjects * @author FrostBug */ public class InteractableFilter implements Filter<RS2Object> { @Override public boolean match(RS2Object v) { return v instanceof InteractableObject; } } List<RS2Object> interactableObjs = getObjects().filter(new InteractableFilter()); Thank you! I did this to get cardinal direction ores around my player. @SuppressWarnings("unchecked") private void filterRocks() { this.rocks = getObjects().filter(new Filter<RS2Object>() { @Override public boolean match(RS2Object v) { if(v instanceof InteractableObject) { if(((InteractableObject)v).getName().equals("Rocks")) { int myX = myPlayer().getX(); int myY = myPlayer().getY(); int rockX = v.getX(); int rockY = v.getY(); return (Math.abs(myX - rockX) == 1 && myY == rockY) || (Math.abs(myY - rockY) == 1 && myX == rockX); } } return false; } }); } Quote Link to comment Share on other sites More sharing options...