Jump to content

Method to get current absorption points


Recommended Posts

Posted
12 hours ago, aniki432789 said:

something like:

 

absorpWidget = getWidgets().get(202, 1, 9);

....

currentAbsorp = Integer.parseInt(absorpWidget.getMessage());

 

 

Take the time to learn and understand how widgets work and how to use them.

Since widget IDs tend to change, you should use something different instead. For example text color, position or something else.

Posted (edited)
    public int getCurrentAbsorptionLevel() {
        final RS2Widget widget = script.getWidgets().get(202, 1, 9);
        if (widget != null && widget.isVisible() && widget.getMessage() != null)
            return Integer.parseInt(widget.getMessage().replace(",", ""));
        return 0;
    }

Should work.

Edited by 01053
Posted
2 hours ago, 01053 said:

    public int getCurrentAbsorptionLevel() {
        final RS2Widget widget = script.getWidgets().get(202, 1, 9);
        if (widget != null && widget.isVisible() && widget.getMessage() != null)
            return Integer.parseInt(widget.getMessage().replace(",", ""));
        return 0;
    }

Should work.

Thanks, I'll write my script this weekend and post it here.

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