Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Wilderness ditch, webwalk help

Featured Replies

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 by sonda

@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.

 

  • Author
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?

  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 by HeyImJamie

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?

  • Author
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)

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 by Explv

  • Author

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?

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

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.