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.

Trouble with Widgets

Featured Replies

I've been having some trouble with widgets lately, can't seem to make it detect whether a widget is visible or not properly.

So I currently have this Task assigned. It can't seem to be able to validate when the widget appears. I noticed it detects the widget right when I stop the script, and if I restart the script without refreshing the script selection window, it detects the widget, but not able to execute the method.

Code:

/**
 * Created by Viston on 11/07/2017.
 */
public class InsideDreamWalkToMid extends Task {
    public InsideDreamWalkToMid(MethodProvider s) {
        super(s);
    }

    @Override
    public boolean canProcess() {
        RS2Widget inDreamWidget;
        inDreamWidget = s.getWidgets().singleFilter(s.getWidgets().getAll(), widget -> widget != null && widget.getMessage().contains("Points:"));
        return inDreamWidget != null && inDreamWidget.isVisible();
    }

    @Override
    public void process() throws InterruptedException {
        Paint.status = "Inside...";
        Vars.middleTile = s.myPosition().translate(10, 15);
        s.getWalking().walk(Vars.middleTile))
    }
}

--------------------------------------------------------------------------------------------------------------------------------------------------------------

A gif of my explanation above > http://i.imgur.com/NXu1zM2.gifv

As you can see, if I refresh before starting the script, it's not able to detect the widget. However, just when I stop the script, the Paint.status = "Inside..."; appears, which means it successfully validated the task.

If I start the script without refreshing, it's able to detect the widget, yet not able to execute the method.

Edited by Visty

Maybe I'm confused but doesn't singleFilter take the root id and filters? Why are you passing singleFilter widgets?

 

Does this work?

    @Override
    public boolean canProcess() {
        RS2Widget inDreamWidget = s.getWidgets().getWidgetContainingText("Points:");
        return inDreamWidget != null && inDreamWidget.isVisible();
    }
  • Author
2 minutes ago, Eliot said:

Maybe I'm confused but doesn't singleFilter take the root id and filters? Why are you passing singleFilter widgets?

 

Does this work?


    @Override
    public boolean canProcess() {
        RS2Widget inDreamWidget = s.getWidgets().getWidgetContainingText("Points:");
        return inDreamWidget != null && inDreamWidget.isVisible();
    }

Nope :feels:

3 minutes ago, Visty said:

Nope :feels:

That's odd, not at my PC right now so can't look for myself. Have you used widget debugger at all? Does it work if you remove the 

&& inDreamWidget.isVisible();
  • Author
5 minutes ago, Eliot said:

That's odd, not at my PC right now so can't look for myself. Have you used widget debugger at all? Does it work if you remove the 


&& inDreamWidget.isVisible();

Same problem. However, when I removed inDreamWidget.isVisible(); It doesn't Paint the status right when stopping the script.

So the script I had above should be working, why else would it be able to validate the Task right when I stop the script? Isn't that weird? :feels:

Edited by Visty

  • Author
12 minutes ago, Eliot said:

I'd need to see your onLoop, etc.

Lmao, fixed it. One of my other Tasks were fucking with it apparently lol.

I had a task that walks to the nmz area in case i'm not there. It was getting validated, which I've fixed now.

Thank you for your effort, it's appreciated! You always there helping out :boge:

It's always these small things that fucks with the whole script :feels: 

Edited by Visty

  • Author
3 minutes ago, Juggles said:
[0:04:44] Juggles: getWidget.get(id,id).interact("Action");

Ids for widgets :feels: nono

Edited by Visty

  • Author
Just now, Juggles said:

static

But but but... :feels: Statics are love men

2 hours ago, Visty said:

Lmao, fixed it. One of my other Tasks were fucking with it apparently lol.

I had a task that walks to the nmz area in case i'm not there. It was getting validated, which I've fixed now.

Thank you for your effort, it's appreciated! You always there helping out :boge:

It's always these small things that fucks with the whole script :feels: 

If you're finding bits of your code are interfering with other parts and it's taking you such a long time to debug, perhaps consider the structure of your code? I don't know what your task class does which you're extending with this code, but if it's just some abstract class with those methods that you're overriding, then that seems pretty useless -why not just have your code in your onLoop where you can see it all at once ^^! 

2 hours ago, Apaec said:

If you're finding bits of your code are interfering with other parts and it's taking you such a long time to debug, perhaps consider the structure of your code? I don't know what your task class does which you're extending with this code, but if it's just some abstract class with those methods that you're overriding, then that seems pretty useless -why not just have your code in your onLoop where you can see it all at once ^^! 

Don't you then end up with scripts like the 3k lines tut that existed somewhere on here :feels: 

4 hours ago, Apaec said:

If you're finding bits of your code are interfering with other parts and it's taking you such a long time to debug, perhaps consider the structure of your code? I don't know what your task class does which you're extending with this code, but if it's just some abstract class with those methods that you're overriding, then that seems pretty useless -why not just have your code in your onLoop where you can see it all at once ^^! 

Please don't encourage this (especially for non-trivial scripts). Having a gigantic onLoop would not make this easier to debug, but quite the contrary. The problem in this case is debugging skills and without them, regardless of structure, you will run into these problems.

Edited by Eliot

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.