Jump to content

Get Widget Hover Text


harrypotter

Recommended Posts

1 minute ago, Apaec said:

Not sure. Try entering that particular widget into the widget debugger in the options menu to see what RS2Widget methods might help you

There's nothing inside the widget debugger that contains this information either that I could find so I'm assuming I can't get it, thought I'd see if any of the guru's here know a secret method :boge:

Edited by harrypotter
Link to comment
Share on other sites

41 minutes ago, harrypotter said:

I want to know what skill the attack style will train. For example the OP image shows that this style will gain Attack XP

I wrote something similar for someone before, you need to hover the widgets:

//Credits to Explv
//Main class
  private Skill currentAttStyle;

  private void setAttackStyle(final Skill attackStyle) {
        Event attStyleEvent = new AttackStyle(attackStyle.toString());
        execute(attStyleEvent);
        if (attStyleEvent.hasFinished()) {
            currentAttStyle = attackStyle;
        }
    }
//AttackStyle class
public class AttackStyle extends Event {

    private final int attackStyleParent = 593;
    private final int[] attackStyleChildren = {3, 7, 11, 15};
    private final String xpType;
    private int attackStyleToCheck = 0;

    public AttackStyle(final String xpType) {
        this.xpType = xpType;
    }


    @Override
    public int execute() throws InterruptedException {
        if (getTabs().getOpen() != Tab.ATTACK) {
            getTabs().open(Tab.ATTACK);
            return 0;
        }

        RS2Widget attackStyleWidget = getWidgets().get(attackStyleParent, attackStyleChildren[attackStyleToCheck]);

        if (attackStyleWidget == null) {
            setFailed();
            return 0;
        }

        if (!attackStyleWidget.hover()) {
            return 0;
        }

        sleep(random(500, 600));

        if (getWidgets().singleFilter(attackStyleParent, widget -> widget.getMessage().matches(".*\\(" + xpType + " XP\\)$")) == null) {
            attackStyleToCheck++;
            if (attackStyleToCheck >= attackStyleChildren.length) {
                setFailed();
            }
            return 0;
        }

        Rectangle widgetBounds = attackStyleWidget.getBounds();

        double colorX = widgetBounds.getMinX() + 5;
        double colorY = widgetBounds.getMinY() + 5;

        if (getColorPicker().colorAt((int) colorX, (int) colorY).getRed() > 100) {
            log("Already selected");
            setFinished();
            return 0;
        }

        if (attackStyleWidget.interact()) {
            setFinished();
        }
        return 0;
    }
}

 

  • Like 4
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...