JagexPlease 0 Posted January 23, 2019 There's a specific area I want my bot to mine rocks in, and only rocks in that area. Is there an alternative to getGameObjects().closest("name of object"); that will only grab objects in an Area. Or is the only way to get the objects specifically on a tile, because that seems rather inelegant. Thanks for reading.
Nex 2546 Posted January 23, 2019 26 minutes ago, JagexPlease said: There's a specific area I want my bot to mine rocks in, and only rocks in that area. Is there an alternative to getGameObjects().closest("name of object"); that will only grab objects in an Area. Or is the only way to get the objects specifically on a tile, because that seems rather inelegant. Thanks for reading. private GameObject getRock() { Area a = new Area(0,0,0,0); return m.getGameObjects().closest(r -> r != null && a.contains(r) && r.getName().contains("name of object")); }
JagexPlease 0 Author Posted January 24, 2019 As far as I can tell that worked perfectly, thank you very much!
ozeki6 32 Posted January 25, 2019 On 1/24/2019 at 1:14 AM, Nex said: private GameObject getRock() { Area a = new Area(0,0,0,0); return m.getGameObjects().closest(r -> r != null && a.contains(r) && r.getName().contains("name of object")); } Creating the area every time you want to return the object. Pls
Nex 2546 Posted January 25, 2019 11 minutes ago, ozeki6 said: Creating the area every time you want to return the object. Pls im sure he can polish it himself i just gave a example so he gets the idea :^)
JagexPlease 0 Author Posted January 26, 2019 Yeah don't worry I'm referring to an area created elsewhere, you're right though Ozeki6 it would have been pretty bad practice. Thanks again for the example Nex, works pretty well.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.