1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Question Task validate and execute

Discussion in 'Developer Support' started by eitherflame, May 9, 2018.

Tags:
  1. eitherflame

    Joined:
    May 8, 2018
    Messages:
    1
    Likes Received:
    0
    Code (Text):
    1.    
    2. public class WalkToNPC extends Task {
    3.  
    4.     private Player me;
    5.  
    6.     private static final Area area = new Area.Rectangular(new Coordinate(XXXX, XXXX, 0), new Coordinate(XXXX, XXXX, 0));
    7.  
    8.     @Override
    9.     public boolean validate() {
    10.  
    11.         me = Players.getLocal();
    12.         return me != null && area.contains(me);
    13. //checking if character is in the correct spot. If it is I want to move to execute, otherwise I want to end here.
    14.     }
    15.  
    16.     @Override
    17.     public void execute() {
    18.          //Validate passed so I'm going to do some stuff now.
    19.     }
    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?
     
  2. CuppaJava

    CuppaJava cuppa.drink(java);

    Joined:
    Mar 13, 2018
    Messages:
    6,120
    Likes Received:
    1,378
    My assumption is yes but I've only ever used TreeBot and LoopingBot. I'm sure someone else will be, well, more sure though.
     

Share This Page

Loading...