Jump to content

Detecting an open widget over the game screen.


Recommended Posts

Posted

How would I be able to detect if there's any open widget on the game screen? I can't seem to do it by checking for changes in other widgets when a widget opens up. I found clicking the run button closes all interfaces, but I need to still be able to check if there is a widget that should be closed. Thanks!

Posted (edited)

widgets.getWidgets() ?

 

I've really gotta explore the API more, I rewrote half the methods in the widgets class... thanks lol

 

 

Edit: widgets.closeOpenInterface(); doesn't close The collect, Sets, or GE History widgets however.

Edited by apa
Posted

I've really gotta explore the API more, I rewrote half the methods in the widgets class... thanks lol

 

 

Edit: widgets.closeOpenInterface(); doesn't close The collect, Sets, or GE History widgets however.

http://osbot.org/forum/topic/69297-close-ge-collection-box-notice-board/?hl=collection%20box

 

 

 

In case your bank interaction misclicks ^^

//close collectionbox (by Botre)

RS2Widget collectionBox = getWidgets().get(402, 2, 11);

if (collectionBox != null && collectionBox.isVisible()) {

collectionBox.interact("Close");

}

And this one by @Novak

//close noticeboard (by Novak)

RS2Widget noticeBoard = script.getWidgets().get(220, 16);

if(noticeBoard != null && noticeBoard.isVisible()) {

noticeBoard.interact("Close");

}

 

Posted (edited)

 

Thanks, I just rewrote mine to check if any wrong interface is open using the sprite of the close button, because it can also misclick the GE in my bot and I didn't want to make a bunch of cases as the Sets and History widgets have different children IDs:

if (!isGEOpen() && !isBankOpen() && widgets.containingSprite(535).size() > 0) {
    if (containsSelection(548, 94, "Toggle Run", true)) {
        interactInterface(548, 94, "Toggle Run");
    }
}
Edited by apa
  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...