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
  • How do I check if I am within a specific area before trying to interact with an object?


    Recommended Posts

    Posted

    I'm making a script that mines and then walks to the back, deposits it and walks back. I've written the script so that I can start it anywhere and it will walk to the specified coordinates and start mining again.

    Here's My Problem:

    since I am using  GameObjects.closest(ore name here) for example, if the script detects any object matching that name along the way to the coordinates, it will try to interact with that object instead.

    How can I check if my player is within a specific area BEFORE trying to interact with an object?

    basically walk,walk,walk -> am I in specified area?   NO(keep walking to coords)   YES(look for/interact with object)

     

     

    Posted

    sounds like you should use closest with a predicate

    GameObjects.closest(x -> x.getName().equals(your desired ore) && yourArea.contains(x))

    this will look at all the objects, test that their name is that ore and they are in that area, is that test is true you get that object

    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
    ×
    ×
    • 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.