Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Question Task validate and execute

Joined
May 8, 2018
Messages
1
Code:
public class WalkToNPC extends Task {

    private Player me;

    private static final Area area = new Area.Rectangular(new Coordinate(XXXX, XXXX, 0), new Coordinate(XXXX, XXXX, 0));

    @Override
    public boolean validate() {

        me = Players.getLocal();
        return me != null && area.contains(me);
//checking if character is in the correct spot. If it is I want to move to execute, otherwise I want to end here.
    }

    @Override
    public void execute() {
         //Validate passed so I'm going to do some stuff now.
    }

I'm new to creating bots so sorry if this question seems dumb. When creating a task for a taskbot if the validate is false the rest of that section won't be ran right?
 
cuppa.drink(java);
Joined
Mar 13, 2018
Messages
7,745
My assumption is yes but I've only ever used TreeBot and LoopingBot. I'm sure someone else will be, well, more sure though.
 
Top