brbxd 2 Share Posted September 14, 2018 public void GrabWine() { if (grabLocation.distance() == 0 && !getInventory().isFull()) { getMagic().castSpell(Normal.TELEKINETIC_GRAB); getMouse().move(wineLocation); GroundItem wine = getGroundItems().closest("Wine of zamorak"); if (wine.exists() && wine != null) { getMagic().castSpellOn(Normal.TELEKINETIC_GRAB, wine); } } } This method is supposed to grab a wine, click telegrab, hover over wine spot, wait for a new wine to spawn, and grab that. But after the first initial grab, it starts spamming the wine tile randomly with the error: [ERROR]23:26:28: Exception has occurred while running! Please report error to developer if problem persists: java.lang.NullPointerException at org.dreambot.brbXD.main.GrabWine(main.java:32) at org.dreambot.brbXD.main.onLoop(main.java:18) at org.dreambot.api.script.AbstractScript.run(AbstractScript.java:250) at java.lang.Thread.run(Thread.java:748) Can somebody point me in the right direction? I've been having trouble on this for awhile now, I don't think I fully understand getGroundItems in general... Link to comment Share on other sites More sharing options...
rubex 28 Share Posted September 14, 2018 The line if (wine.exists() && wine != null) should be if (wine != null && wine.exists()) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.