Jump to content

Crossing Wildy-ditch


Recommended Posts

Posted

The way I did it was...

public void WalkToWild() {
        RS2Widget enterWildernessButton = getWidgets().singleFilter(getWidgets().getAll(), new WidgetActionFilter("Enter Wilderness"));
        if (enterWildernessButton != null) {
            enterWildernessButton.interact("Enter Wilderness");
        } else {
            log("Walking to the wilderness...");
            status = ("Walking to the wildernes...");
            WebWalkEvent webWalkEvent = new WebWalkEvent(wilderness);
            webWalkEvent.setBreakCondition(new Condition() {
                @Override
                public boolean evaluate() {
                    return getWidgets().getWidgetContainingText("Enter Wilderness") != null;
                }
            });
            getWalking().webWalk(wilderness); //Wilderness is my Area
        }

class WidgetActionFilter implements Filter<RS2Widget> {

    private final String action;

    WidgetActionFilter(final String action) {
        this.action = action;
    }

    @Override
    public boolean match(RS2Widget rs2Widget) {
        if (rs2Widget == null) {
            return false;
        }
        if (rs2Widget.getInteractActions() == null) {
            return false;
        }
        for (String action : rs2Widget.getInteractActions()) {
            if (this.action.equals(action)) {
                return true;
            }
        }
        return false;
    }
}

    }

 

  • Like 1

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