ImLife 14 Share Posted April 8 Hello scripters! I am once again asking for your assistance! I am trying to learn the Tree branch architecture, however the isValid() method does not seem to work as described in the documentation: My thoughts are that if a branch is valid it should run the leaf if the leaf is valid. Basically a double if statement: As seen below: BranchOne = true LeafOne=false LeafTwo= true BranchOne: run - LeafOne: do not run - LeafTwo: run However, this is my code and it never runs the Leaf node "DoWalkTreeArea" public class DoWalkTreeArea extends Leaf { @Override public boolean isValid() { return true; } @Override public int onLoop() { Logger.log("Looping do walk tree area"); Tile closestTile = WillowArea.getNearestTile(Players.getLocal()); Walking.walk(closestTile); Sleep.sleepUntil(() -> Players.getLocal().isMoving(), 1000, 200); return 1000; } } public class WalkTreeArea extends Branch { @Override public boolean isValid() { return true; } } @ScriptManifest(name = "test", version = 1, author = "ImLife", category = Category.WOODCUTTING) public class Main extends TreeScript { @Override public void onStart() { addBranches(new WalkTreeArea()).addLeaves(new DoWalkTreeArea()); } @Override public int onLoop() { Logger.log("Looping main loop"); return this.getRoot().onLoop(); } } The code never logs "Looping do walk tree area". why is that? Note: it works if I set everything to false Link to comment Share on other sites More sharing options...
ImLife 14 Author Share Posted April 9 (edited) After 5 hours... Kill me Fixed parentheses: @Override public void onStart() { addBranches(new WalkTreeArea()).addLeaves(new DoWalkTreeArea()); } @Override public void onStart() { addBranches(new WalkTreeArea().addLeaves(new DoWalkTreeArea())); } Edited April 9 by ImLife added more code tobzhax 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now