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
  • Null pointer exception


    Bladez
     Share

    Recommended Posts

    Hello all, i'm making a firemaking script and wrote some code to define whether i'm standing on a fire or not.
    The only problem is i'm getting a null pointer exception which is making the script hang.
    Can anyone see anything wrong with my code?
    Many thanks in advance
     

    		Tile fire = getLocalPlayer().getTile();
        	GameObject Firelocation = getGameObjects().getTopObjectOnTile(fire);
    		GameObject Fireobject = getGameObjects().closest(FireID -> FireID.getID() == 26185);
    
                if(Firelocation != null && Firelocation == Fireobject) {
            		getWalking().walk(FIREAREA.getRandomTile());
                	sleepUntil(() -> !getLocalPlayer().isAnimating(), 3000);
                	log("Walking");
                }
    • 14:20:31: Exception has occurred while running! Please report error to developer if problem persists: java.lang.NullPointerException at Firemaker.onLoop(Firemaker.java:46) at org.dreambot.api.script.AbstractScript.run(AbstractScript.java:264) at java.lang.Thread.run(Unknown Source)
    Link to comment
    Share on other sites

    It actually turned out to be the way of clicking randomly in inventory, it was working perfectly earlier?
                    getInventory().getRandom(item -> item != null && item.hasAction("Logs")).interact("Use");

    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.