wkmac 0 Share Posted October 24, 2015 (edited) This is my current code for it public void shoot() { if (getTabs().isOpen(Tab.INVENTORY)) { Inventory inventory = getInventory(); Item arrows = inventory.get("Bronze arrow"); if(arrows != null){ arrows.interact(); } getTabs().openWithFKey(Tab.COMBAT); } else { getTabs().open(Tab.INVENTORY); Inventory inventory = getInventory(); Item arrows = inventory.get("Bronze arrow"); if(arrows != null){ arrows.interact(); getTabs().openWithFKey(Tab.COMBAT); } } getWalking().walk(new Tile(2670, 3418, 0)); int i; for (i = 0; i < 10; i++) getCamera().mouseRotateToEntity(getGameObjects().closest("Target")); getGameObjects().closest("Target").interactForceRight("Fire-at"); sleepUntil(() -> getWidgets().getWidget(325).isVisible(), 3000); if(getWidgets().getWidget(593) != null){ getWidgets().getWidget(593).getChild(28).interact(); } state = 0; } Im not sure whether im having the issue in the code but here are the exceptions that are thrown [ERROR]12:49:21: Exception has occurred while running! Please report error to developer if problem persists: java.lang.NullPointerException at main.Main.lambda$shoot$0(Main.java:92) at org.dreambot.api.methods.MethodProvider.sleepUntil(MethodProvider.java:75) at main.Main.shoot(Main.java:92) at main.Main.onLoop(Main.java:43) at org.dreambot.api.script.AbstractScript.run(AbstractScript.java:223) at java.lang.Thread.run(Unknown Source) [ERROR]12:49:23: Exception has occurred while running! Please report error to developer if problem persists: java.lang.NullPointerException at main.Main.shoot(Main.java:83) at main.Main.onLoop(Main.java:43) at org.dreambot.api.script.AbstractScript.run(AbstractScript.java:223) at java.lang.Thread.run(Unknown Source) Edited October 24, 2015 by wkmac Link to comment Share on other sites More sharing options...
DefCon 121 Share Posted October 24, 2015 Not entirely sure if this is the issue, but try adding: getWidgets().getWidget(325)!= null to your condition sleepUntil(() -> getWidgets().getWidget(325)!= null && getWidgets().getWidget(325).isVisible(), 3000); Link to comment Share on other sites More sharing options...
wkmac 0 Author Share Posted October 24, 2015 Not entirely sure if this is the issue, but try adding: getWidgets().getWidget(325)!= null to your condition sleepUntil(() -> getWidgets().getWidget(325)!= null && getWidgets().getWidget(325).isVisible(), 3000); is the long as the second argument the timeout value? Link to comment Share on other sites More sharing options...
Dreamlicker 749 Share Posted October 24, 2015 is the long as the second argument the timeout value? Yes, your first argument is the boolean statement that you want to wait until its true, but your second argument is how long you will wait to break out of the sleep even if the boolean isnt true. Link to comment Share on other sites More sharing options...
Recommended Posts