Jump to content

Script refusing to acknowledge the widget on screen


hreyvirtue

Recommended Posts

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

 

Link to comment
Share on other sites

  On 12/4/2018 at 2:50 PM, Mysteryy said:

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

Expand  

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
Link to comment
Share on other sites

  On 12/4/2018 at 2:58 PM, 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

Expand  

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
Link to comment
Share on other sites

  On 12/4/2018 at 3:10 PM, hreyvirtue said:

That worked,

thank you so much :3

Expand  

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
Link to comment
Share on other sites

  On 12/4/2018 at 3:10 PM, Mysteryy said:

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

Let me know if that works, just curious now.

Expand  

270, 3 didn't work 

  On 12/4/2018 at 3:25 PM, 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.

Expand  

Oooh, I see

Thanks <3

Link to comment
Share on other sites

  On 12/4/2018 at 3:25 PM, 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.

Expand  

 

  On 12/4/2018 at 3:26 PM, hreyvirtue said:

270, 3 didn't work 

Oooh, I see

Thanks <3

Expand  

 

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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