Chikan Posted December 30, 2017 Share Posted December 30, 2017 Hey, so I'm trying to figure out how get a text value for this specific dialogue box. 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. Link to comment Share on other sites More sharing options...
Chris Posted December 30, 2017 Share Posted December 30, 2017 Null check when you interact please. Link to comment Share on other sites More sharing options...
Explv Posted December 30, 2017 Share Posted December 30, 2017 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. Link to comment Share on other sites More sharing options...
The Undefeated Posted December 30, 2017 Share Posted December 30, 2017 (edited) Nvm. Edited December 30, 2017 by The Undefeated Link to comment Share on other sites More sharing options...
Explv Posted December 30, 2017 Share Posted December 30, 2017 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. Link to comment Share on other sites More sharing options...
Explv Posted December 30, 2017 Share Posted December 30, 2017 (edited) 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 December 30, 2017 by Explv 4 Link to comment Share on other sites More sharing options...
Chikan Posted December 30, 2017 Author Share Posted December 30, 2017 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 1 Link to comment Share on other sites More sharing options...