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
  • Script threw an error | Can't pick up bones?


    krypt1c
     Share

    Recommended Posts

     public void bonesObject() {
            GameObject bones = GameObjects.closest(gameObject -> gameObject != null && gameObject.getName().equals("Bones"));
            if(chickenLocation.contains(getLocalPlayer())) {
                if(bones.interact("Take")) {
                    sleepUntil(() -> Inventory.contains("Bones"), 2000);
                    if(Inventory.contains("Bones")) {
                        Inventory.interact("Bones", "Bury");
                        sleepUntil(() -> !Inventory.contains("Bones"), 5000);
                    }
                }
            } else if(!chickenLocation.contains(getLocalPlayer())) {
                if(new Walking().walk(chickenLocation.getCenter())) {
                    sleep(Calculations.random(1000, 3000));
                }
            }
        }

    Either I'm an idiot, or I don't understand something. The method above should interact with the closest bones by picking them up and burying them if they are in the player's inventory.

    I honestly have no idea why its giving me an error in dreambot's console.
    If anyone could help me out, I would really appreciate it

    thanks!

    Link to comment
    Share on other sites

    7 hours ago, TheCloakdOne said:

    if there are no bones in the area bones will == null, you cant interact on null so it throws NPE

    But it throws an error even though that there are bones in the area

    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.