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
  • Debug Console Error Unknown


    Recommended Posts

    Hello I am fairly new and I am having problems with a script. It used to work fine but now I am getting random errors. One in particular keeps showing up, but I don't understand what it means.

    The overall script is just picking items up, then waiting until they spawn again, and then doing that until the inventory is full or it runs out of food. I am currently using a while loop to do so within the onLoop (I know, not supposed to but can't figure out how else to do it).

    The error is below.

    • [ERROR]16:25:41: Exception has occurred while running! Please report error to developer if problem persists: java.lang.NullPointerException at Test.Main.onLoop(Main.java:32) at org.dreambot.api.script.AbstractScript.run(AbstractScript.java:264) at java.lang.Thread.run(Unknown Source)

    Forgive how messy the code is as well, but I have been trying to debug this for a while so cleaning it will be later. Code is below:

    public void health(){
            if (getCombat().getHealthPercent() < 50) {
                sleep(Calculations.random(100, 300));
                getInventory().interact(379, "Eat");
        public int onLoop() {
                int food = getInventory().count(food);
                if(getGroundItems().closest(stuff) == null){
                if(food < 2 || getInventory().isFull()) {
            return 10000;
    Link to comment
    Share on other sites


    1 hour ago, Pandemic said:

    You aren't checking if the ground item exists when you try to take it.

    How would I do that correctly then? Also, when I turn this into a for loop (that doesn't accomplish what is needed) I don't get this error. I've been beating my head against the desk for a while trying to not use a while loop, but I don't know of a way to get past it.

    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

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