Jump to content

Get Widget Hover Text


Recommended Posts

Posted (edited)
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
Posted
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

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