JagexPlease 0 Share 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. Link to comment Share on other sites More sharing options...
Nex 2542 Share 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")); } Link to comment Share on other sites More sharing options...
JagexPlease 0 Author Share Posted January 24, 2019 As far as I can tell that worked perfectly, thank you very much! Link to comment Share on other sites More sharing options...
ozeki6 32 Share 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 Link to comment Share on other sites More sharing options...
Nex 2542 Share 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 :^) Link to comment Share on other sites More sharing options...
JagexPlease 0 Author Share 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.