sonda Posted November 26, 2017 Share Posted November 26, 2017 (edited) I know this has probably been talked about quite a bit, but i was unsuccessful in finding a relevant answer ( that worked for me ) Here is what i currently have at the top of my onloop ' if (widgets.get(475, 11) != null) { widgets.get(475, 11).interact(); log("Crossing Wilderness Ditch"); sleep(500); walking.webWalk(midgy); log("Resuming trek"); } if (!Areal.contains(me) && inventory.getAmount(selectedFood) >= 4) { status = "Walking to place"; log("Walking to Area"); WebWalkEvent evt = new WebWalkEvent(midgy); evt.setBreakCondition(new Condition() { @Override public boolean evaluate() { return widgets.get(475, 11).isVisible(); } }); execute(evt); } but It seems to not work, im sure its something i did , or didn't do correctly. Any help is appreciated. [ERROR][Bot #1][11/26 08:53:40 AM]: Error executing event : org.osbot.rs07.event.WebWalkEvent@2413fe0 java.lang.NullPointerException at thing.main$2.evaluate(main.java:210) at org.osbot.rs07.event.WebWalkEvent.execute(co:266) at org.osbot.rs07.event.EventExecutor$2.run(zj:212) at org.osbot.rs07.event.EventExecutor.execute(zj:22) at org.osbot.rs07.script.MethodProvider.execute(ql:744) at thing.main.onLoop(main.java:213) at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(cg:72) at java.lang.Thread.run(Thread.java:748) line 210 : return widgets.get(475, 11).isVisible(); line 213: execute(evt); IF i manually click the ditch, it works great after. I know i can walk TO the ditch, HANDLE the ditch, then WALK to my area, trying to avoid all that mess if possible. Edited November 26, 2017 by sonda Quote Link to comment Share on other sites More sharing options...
Explv Posted November 26, 2017 Share Posted November 26, 2017 @sonda In your break condition: return widgets.get(475, 11).isVisible(); You need to make sure the widget returned by .get() is not null before calling isVisible. Otherwise an NPE will be thrown. 1 Quote Link to comment Share on other sites More sharing options...
sonda Posted November 26, 2017 Author Share Posted November 26, 2017 7 minutes ago, Explv said: @sonda In your break condition: return widgets.get(475, 11).isVisible(); You need to make sure the widget returned by .get() is not null before calling isVisible. Otherwise an NPE will be thrown. i just went ahead and changed it to !=null instead. and that seems to work, duh! thanks explv! It does seem to take a good 5-10 seconds to tackle this task however, is that normal? Quote Link to comment Share on other sites More sharing options...
HeyImJamie Posted November 26, 2017 Share Posted November 26, 2017 (edited) if (s.getObjects().closest("Wilderness Ditch") != null) { status = "Entering Wilderness."; if (s.getWidgets().getWidgetContainingText("Enter Wilderness") != null && s.getWidgets().getWidgetContainingText("Enter Wilderness").isVisible()) { s.getWidgets().getWidgetContainingText("Enter Wilderness").interact(); Sleep.sleepUntil(() -> WAIT_AREA.contains(s.myPlayer()), 5000); } else { RS2Object WildyDitch = s.getObjects().closest("Wilderness Ditch"); status = "Clicking Ditch."; if (WildyDitch != null && WildyDitch.isVisible()) { WildyDitch.interact("Cross"); Sleep.sleepUntil(() -> s.getWidgets().getWidgetContainingText("Enter Wilderness").isVisible(), 5000); } } This is what I did in an old script of mine. I just broke the webwalkevent when the ditch was on screen, called this handleDitch method and then re-made a webwalkevent. I'd recommend checking the interact methods prior to sleeping though, I was obviously shitter than I am now when writing this script lmao. Edited November 26, 2017 by HeyImJamie 1 Quote Link to comment Share on other sites More sharing options...
Explv Posted November 26, 2017 Share Posted November 26, 2017 46 minutes ago, sonda said: i just went ahead and changed it to !=null instead. and that seems to work, duh! thanks explv! It does seem to take a good 5-10 seconds to tackle this task however, is that normal? You mean it takes 5-10 seconds to click the widget? Quote Link to comment Share on other sites More sharing options...
sonda Posted November 26, 2017 Author Share Posted November 26, 2017 16 minutes ago, Explv said: You mean it takes 5-10 seconds to click the widget? No the widget clicking part is quick, its the clicking the ditch that takes a minute(gets to the ditch and waits), then a few seconds after crossing the ditch to resume walking (2-3 seconds here, not bad) Quote Link to comment Share on other sites More sharing options...
Explv Posted November 26, 2017 Share Posted November 26, 2017 (edited) 27 minutes ago, sonda said: No the widget clicking part is quick, its the clicking the ditch that takes a minute(gets to the ditch and waits), then a few seconds after crossing the ditch to resume walking (2-3 seconds here, not bad) You could maybe try handling the ditch crossing yourself. The delay before might be an issue where WebWalkEvent takes a while to break, i'm not really sure though. Edited November 26, 2017 by Explv 1 Quote Link to comment Share on other sites More sharing options...
sonda Posted November 26, 2017 Author Share Posted November 26, 2017 Alright, thank you. Btw , is this the proper method for handling something like this? First time running across an issue like this, could i use this going forward with other similar issues? Quote Link to comment Share on other sites More sharing options...
HeyImJamie Posted November 26, 2017 Share Posted November 26, 2017 2 hours ago, sonda said: Alright, thank you. Btw , is this the proper method for handling something like this? First time running across an issue like this, could i use this going forward with other similar issues? Pretty much yes, although with larger scripts simply putting it at the top of onLoop can cause issues. Break the webwalk event - handle whatever - continue on Quote Link to comment Share on other sites More sharing options...