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.

Cant click on widget ..

Featured Replies

Trying to click "Deposit loot" in the looting bag. 

I have tried the following combinations:

RS2Widget depositLootButton = getWidgets().get(15, 8);
RS2Widget depositLootButton = getWidgets().get(15, 9);
RS2Widget depositLootButton = getWidgets().get(548, 77);
RS2Widget depositLootButton = getWidgets().getWidgetContainingAction("Deposit loot");

depositLootButton.interact("Deposit loot");
depositLootButton.interact();


What am i doing wrong? first time using widgets. i assume the widget code is 15,8 because the text is green and the widget i want to click is highlighted in green, but i have tried all other combinations aswell.

 

EDIT: i managed to get it to click it using 

RS2Widget depositLootButton = getWidgets().getWidgetContainingAction("Deposit loot");
   RS2Widget depositLootButton = getWidgets().getWidgetContainingAction("Deposit loot");
                  

But only if i didnt check if it was null first, and it threw a null exception error but it still clicked it. So i dont know what to do, if i only click it if its not null it wont click it.

osbot.jpg

Edited by saintpaul1

@saintpaul1 Run this and see what gets logged
 

	final RS2Widget widget = getWidgets().getAll().stream()
                .filter(w -> w.hasAction("Deposit loot"))
                .findFirst()
                .orElse(null);
        if (widget != null) {
            log("RootId: " + widget.getRootId());
            log("ChildId: " + widget.getSecondLevelId());
            log("GrandChildId: " + widget.getThirdLevelId());
        } else {
            log("Widget couldn't be found!");
        }

 

  • Author
31 minutes ago, Gunman said:

@saintpaul1 Run this and see what gets logged
 

	final RS2Widget widget = getWidgets().getAll().stream()
                .filter(w -> w.hasAction("Deposit loot"))
                .findFirst()
                .orElse(null);
        if (widget != null) {
            log("RootId: " + widget.getRootId());
            log("ChildId: " + widget.getSecondLevelId());
            log("GrandChildId: " + widget.getThirdLevelId());
        } else {
            log("Widget couldn't be found!");
        }

 

Thanks gunman, this is what it logs :

 

[INFO][Bot #1][04/22 11:00:45 PM]: RootId: 15
[INFO][Bot #1][04/22 11:00:45 PM]: ChildId: 8
[INFO][Bot #1][04/22 11:00:45 PM]: GrandChildId: -1

So i guess i should include -1?

Also i got it to run by using .isvisible instead of nullchecking, i got a null exception error but it ran still, but id rather do it properly.

 

 

This is my code now :
 

 RS2Widget depositLootingBag = getWidgets().get(15, 2, 0);
        RS2Widget bagEmpty = getWidgets().getWidgetContainingText("The bag is empty.");
        RS2Widget depositLootButton = getWidgets().get(15, 8 , -1);
        RS2Widget dismiss = getWidgets().getWidgetContainingAction("Dismiss");

        if (getBank().isOpen()) {
            Item lootingBag = getInventory().getItem("Looting bag");
            if (depositLootingBag != null) {
                log("Lets deposit looting bag items.");
                lootingBag.interact("View");
                Util.Sleep.sleepUntil(() -> depositLootButton !=null, 10000);
                if (depositLootButton !=null) {
                    log("Item in bag to deposit.");
                    depositLootButton.interact("Deposit loot");
                    Util.Sleep.sleepUntil(() -> bagEmpty !=null, 5000);

                 if (bagEmpty !=null) {
                    log("Clicking dismiss.");
                    dismiss.interact("Dismiss");
                }

                }

                return 100;
            }
        }


 

Edited by saintpaul1

4 minutes ago, saintpaul1 said:

So i guess i should include -1?

Also i got it to run by using .isvisible instead of nullchecking, i got a null exception error but it ran still, but id rather do it properly.

-1 should mean it's not a grand child so no.

I don't get how it would run if the widget is null, you can't call a method on something that doesn't exist. My guess is the null was from the .isVisible check if you interacted with the widget.

  • Author
13 hours ago, Gunman said:

-1 should mean it's not a grand child so no.

I don't get how it would run if the widget is null, you can't call a method on something that doesn't exist. My guess is the null was from the .isVisible check if you interacted with the widget.

Ah okay yeah your right. 

i got it working now perfect, heres the code if anyone needs :

 

if (getBank().isOpen()) {
            RS2Widget depositLootingBag = getWidgets().getWidgetContainingAction("View");
            RS2Widget bagEmpty = getWidgets().getWidgetContainingText("The bag is empty.");
            RS2Widget depositLootButton = getWidgets().getWidgetContainingAction("Deposit loot");
            RS2Widget dismiss = getWidgets().getWidgetContainingAction("Dismiss");
            if (depositLootingBag != null) {
                log("Deposit looting bag is not null");
                depositLootingBag.interact();
        }
            if (depositLootingBag == null) {
                log("Deposit looting bag is null");
            }
            if (depositLootButton !=null && bagEmpty ==null) {
                log("Pressing deposit loot button");
                depositLootButton.interact("Deposit loot");
            }
            if (bagEmpty !=null) {
                log("Bag empty message onscreen");
                dismiss.interact();
            }

 

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.