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.

Widget not returning text

Featured Replies

Hey, so I'm trying to figure out how get a text value for this specific dialogue box.

895edea435a54d246d67f87ec07f4c6e.png

I've checked the widget debugger, and I've found

getWidgets().containingText(229, "You must ask the foreman's permisson before using the blast furnace") != null

This is what I can pull out of it, however when I go to try to use it

if (getWidgets().containingText(229, "You must ask the foreman's permisson before using the blast furnace") != null) {
	hasPayedForeman = false;
}

 

After this my script goes into the task to pay the foreman

 

NPC foreman = getNpcs().closest("Blast Furnace Foreman");
RS2Widget payWindow = c.getWidgets().get(219, 0, 0);
		
	if (payWindow == null) {
			foreman.interact("Pay");
			Timing.waitCondition(() -> getDialogues().inDialogue(), 3500, 1500);
			
	} else if (getDialogues().inDialogue()) {
			if (payWindow != null) {
				getDialogues().selectOption(1);
				hasPayedForeman = true;
			}	
		}		
	}

 

My problem is that it just loops between the two in I guess a kind of "spammy" fashion, instead of the boolean going to false while the widget is != null and then going back to true after the foreman is paid.

Null check when you interact please.

getWidgets().containingText returns a List<RS2Widget>

You are checking that the result of getWidgets().containingText() is not null, however that will always be true, because containingText will never return a null List.

What you should be using instead is getWidgets().getWidgetContainingText() which returns an RS2Widget.

1 minute ago, The Undefeated said:

I'm pretty sure Widgets.ContainingText() ignores the chatbox / dialogue.

It ignores widgets with root id 162 I believe.

The root id of this widget is supposedly 229, so that shouldn't be an issue.

Issue solved.

OP should have been using getWidgets().getWidgetContainingText not getWidgets().containingText

And also the message "You must ask the foreman's permisson before using the blast furnace" should contain a line break tag "<br>"

This line break tag is only visible if you look at the message in the widget debugger.

"You must ask the foreman's permisson before using the blast<br>furnace"

Edited by Explv

  • Author
40 minutes ago, Explv said:

Issue solved.

OP should have been using getWidgets().getWidgetContainingText not getWidgets().containingText

And also the message "You must ask the foreman's permisson before using the blast furnace" should contain a line break tag "<br>"

This line break tag is only visible if you look at the message in the widget debugger.

"You must ask the foreman's permisson before using the blast<br>furnace"

Ty dad

59 minutes ago, Chris said:

Null check when you interact please.

>:c

  • Night locked this topic
Guest
This topic is now closed to further replies.

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.