November 8, 201510 yr How do I get all Objects in a range? Lets say i wanna get all Bird_snare object in a range of 10 what whould be the best way to do that?
November 8, 201510 yr To get every object, you'll need to use streams: int rad = 10; String name = "bird snare"; //case doesn't matter List<Entity> list = getObjects().getAll().stream().filter((e) -> (e != null && e.exists() && e.getName().equalsIgnoreCase(name) && getMap().distance(e) <= rad)).collect(Collectors.toList()); Take a look at my streams tutorial to learn more. EDIT: getObjects() also has a filter() method, however I prefer streams. Edited November 8, 201510 yr by Bobrocket
November 8, 201510 yr List<RS2Object> objs = getObjects().filter(o -> myPosition().distance(o) < 10 && "Bird snare".equals(o.getName())); Edited November 8, 201510 yr by FrostBug
November 8, 201510 yr Author List<RS2Object> objs = getObjects().filter(o -> myPosition().distance(o) < 10 && "Bird snare".equals(o.getName())); Thanks for the code but getting error on the ( -> ) , osbot syntax error on "-" -- expected. Does "o" supposed have value? or do i have to import something? (Srry, I'm not to familiar with these types of complicated code in OSbot)
November 8, 201510 yr Thanks for the code but getting error on the ( -> ) , osbot syntax error on "-" -- expected. Does "o" supposed have value? or do i have to import something? (Srry, I'm not to familiar with these types of complicated code in OSbot) Like soldtodie said, you have to install Java 8, and set the source version of your project to 8
November 17, 201510 yr Author Like soldtodie said, you have to install Java 8, and set the source version of your project to 8 i have changed my JDK java from 1.7 to 1.8 but it seems the problem is still ocuring in eclipse would you mind helping me : - ) (or pushing me in the right direction)
November 17, 201510 yr i have changed my JDK java from 1.7 to 1.8 but it seems the problem is still ocuring in eclipse would you mind helping me : - ) (or pushing me in the right direction) You probably need to enable it in your IDE.
Create an account or sign in to comment