Bladez 0 Share Posted April 6, 2020 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 More sharing options...
Bladez 0 Author Share Posted April 6, 2020 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 More sharing options...
Defiled 415 Share Posted April 6, 2020 Fireobject is returning null that's why.. null check it n -> n!=null and/or n!=null Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now