mitsuki Posted September 20, 2020 Posted September 20, 2020 I'm trying to mine a rock at a specific location, but can't seem to work out how to do it? I assumed it would be something along of lines of getObjects().closest("Rock") at location (1334, 1553); But I can't work out how to add a location to the object. Do I need to make my own method or something to check the location? like: public boolean rockLocation() { if (getObjects().closest("Rock").exists && Location == (1334, 1553)) { return true; } } I just don't know how to check the location. Cheers guys
ez11 Posted September 20, 2020 Posted September 20, 2020 Use filters: getObjects().closest(o -> o.getname.equals("Rock") && o.getPosition().equals(POSITION)) 4
mitsuki Posted September 21, 2020 Author Posted September 21, 2020 On 9/20/2020 at 12:54 PM, ez11 said: Use filters: getObjects().closest(o -> o.getname.equals("Rock") && o.getPosition().equals(POSITION)) Thank you dude, any chance you can explain what the code is doing so i can understand fully using comments? No worries if not man
ez11 Posted September 21, 2020 Posted September 21, 2020 13 minutes ago, mitsuki said: Thank you dude, any chance you can explain what the code is doing so i can understand fully using comments? No worries if not man There are a lot of ways to filter stuff, thats just a quick way to filter the closest object that meets the criteria. You could also filter for .hasAction() or pretty much anything else. Just google "osbot filter" for more info/examples 1
Developer Patrick Posted September 21, 2020 Developer Posted September 21, 2020 Use getObjects().getAt(x, y) and filter that on name/id. getAt(x, y) is optimized for these kinds of things 3