Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • Interacting with GameObjects in a specific Area


    JagexPlease
     Share

    Recommended Posts

    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

    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

    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

    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

    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

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.