Jump to content

Script refusing to acknowledge the widget on screen


Recommended Posts

Posted

I'm trying to make a flax bot, but it just refuses to acknowledge the "would you like to spin" widget on screen;

the code:

RS2Widget wouldyouliketospin = getWidgets().getWidgetContainingText("spin"); //spin
RS2Widget spin= getWidgets().get(270, 5);
if (getInventory().contains("Flax")) { //Does inventory contain flax?

    if (!Wheel_Area.contains(myPlayer())) { //Are we near the Spinning Wheel?
        log("In wheel area");

        if (wheel != null) { //Is the Spinning Wheel in clickable distance?
            wheel.interact("Spin"); //Spin boy
            new ConditionalSleep(5000){
                @Override
                public boolean condition(){
                    return myPlayer().isAnimating() || !wheel.exists();
                }
            }.sleep();

            log("Beginning to spin flax");

            if (spin != null) { //Choose Bowstring
            this.getKeyboard().typeKey('3');
                log("Spinning flax");

            } else {
                log("I broke");

All it does is return "I broke"; what am I doing wrong? I've tried putting in the widget id for the bowstring button as well, with no success

 

 

Thanks for your help

 

 

Ignore my awful coding btw thx

 

Posted (edited)
9 minutes ago, Mysteryy said:

Are you sure you have the right id? Also, why do you have "RS2Widget wouldyouliketospin"  but not use that instead?

It was my first option, but didn't work so I tried the other way.  

is this the wrong one?

 

And i've tried 270,16 (white border around bow string) to no avail

image.png

Edited by hreyvirtue
Posted
8 minutes ago, hreyvirtue said:

It was my first option, but didn't work so I tried the other way.  

is this the wrong one?

 

And i've tried 270,16 (white border around bow string) to no avail

image.png

Well I'm at work at the moment, so I cant really try anything. 

But you might try like:

RS2Widget spin = getWidgets().getWidgetContainingText(270, "What would you like to spin?"); //spin
  • Heart 1
Posted (edited)
9 minutes ago, hreyvirtue said:

That worked,

thank you so much :3

Yea also, try using 270, 3 instead of 270, 5.

Let me know if that works, just curious now.

 

 

Edit: I told pat (because I also saw this same problem the other day). For me I used the same thing that I suggested to you and it worked. He took a look and said that getWidgetContainingText(text) ignores chatbox. Its probably to avoid falsely matching text if a user says something. Like if a user says a message with the word "spin" in it, it would match that message when really you wanted the spinning widget, not a message from some random user where they said the word "spin". 

Edited by Mysteryy
Posted
14 minutes ago, Mysteryy said:

Yea also, try using 270, 3 instead of 270, 5.

Let me know if that works, just curious now.

270, 3 didn't work 

1 minute ago, Malcolm said:

You don't even need to have the child widget here as you're using the keyboard to interact with the widget. 

so as long as widget 270 is visible you can just type 3.

Oooh, I see

Thanks <3

Posted
2 hours ago, Malcolm said:

You don't even need to have the child widget here as you're using the keyboard to interact with the widget. 

so as long as widget 270 is visible you can just type 3.

 

2 hours ago, hreyvirtue said:

270, 3 didn't work 

Oooh, I see

Thanks <3

 

Probably still want to make sure that the correct text is present.

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...