Hello everyone!
I'm trying to figure out widgets, and eventually want to get the text of a widget from a dialogue.
This is my code:
RS2Widget chatWidget = getWidgets().get(231, 4);
NPC npc = getNpcs().closest(Area, "Doomsayer");
if (npc!= null && npc.isVisible() && !dialogues.inDialogue()) {
npc.interact("Talk-to");
new ConditionalSleep(10000,500) {
@Override
public boolean condition() throws InterruptedException {
return dialogues.inDialogue();
}
}.sleep();
log("Im in dialogue");
log("Waiting for widget to become visible");
new ConditionalSleep(10000,500) {
@Override
public boolean condition() throws InterruptedException {
return chatWidget != null;
}
}.sleep();
if (chatWidget != null) {
log("Widget exists");
} else {
log("Widget doesn't exist");
}
}
My bot opens the dialogue which should make the widget visible, but it doesn't recognise the widget:
https://imgur.com/a/h69uvPc
Does anyone know whats going on?
Thanks in advance!
Mephisto