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 doesn't exist... Need help

Featured Replies

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

 

Edited by Mephisto

@Mephisto Use the debugger tool it will tell you stuff. Like actions and the message the widget displays.

Also are you using widgets for dialogue interaction? Why not use the dialogue API? Are you just using this to learn widgets?

 

EDIT: Found the issue. You're storing the widget data at the beginning and you're not updating that data.

RS2Widget chatWidget = getWidgets().get(231, 4);

^This is still null because you never updated it, and when you pull chatWidget it pulls the data before you start talking to the NPC. Hope you get what I am saying.

Edited by Gunman

yeah what gunman said. Logic error

  • Author
20 hours ago, Gunman said:

@Mephisto Use the debugger tool it will tell you stuff. Like actions and the message the widget displays.

Also are you using widgets for dialogue interaction? Why not use the dialogue API? Are you just using this to learn widgets?

 

EDIT: Found the issue. You're storing the widget data at the beginning and you're not updating that data.


RS2Widget chatWidget = getWidgets().get(231, 4);

^This is still null because you never updated it, and when you pull chatWidget it pulls the data before you start talking to the NPC. Hope you get what I am saying.

Jup fixed the issue :) 

I indeed stored the widget data when it didn't exist yet. 

Thanks!

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.