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 What am I doing wrong? [TreeBot barebones]

Joined
Jul 31, 2018
Messages
33
I don't get it. This should work, right?
I'm getting "null Failure Task" exception, why?


Does not look like null to me. Everything seems to be referenced correctly.
By all examples this should work. This is literally all the code.


Code:
public class Main extends TreeBot {
    @Override
    public TreeTask createRootTask() {
        return new InventoryEmpty();
    }
}


Code:
public class InventoryEmpty extends BranchTask {

    private PrintStuff printStuff = new PrintStuff();

    @Override
    public TreeTask successTask() {
        return printStuff;
    }
    @Override
    public TreeTask failureTask() {
        return printStuff;
    }

    @Override
    public boolean validate() {
        return Inventory.isEmpty();
    }
}


Code:
public class PrintStuff extends LeafTask {
    @Override
    public void execute() {
        System.out.println("Print stuff");
    }
}
 
Joined
Jul 31, 2018
Messages
33
@DrManhattan I don't see any problems at a glance, can you post the full exception please?
 
Yeah, naw fam it's not your code; I just ran it and it runs fine.


Code:
java.lang.UnsupportedOperationException: Branch(com.DrManhattan.bots.BasicTreeBot.branches.InventoryEmpty) had a null Failure Task.
    at com.runemate.game.api.script.framework.tree.TreeBot.onLoop(ebc:79)
    at com.runemate.game.api.script.framework.LoopingBot.run(oec:77)
    at com.runemate.game.api.script.framework.AbstractBot.start(cec:19569)
    at nul.iiiIiIiiIiiIi.run(lxc:12)

This is the full exception.

And yeah, I'm confident that the code should work as well. But it isn't.
But thank you for verifying this to me @CuppaJava.

I guess it has to be because of my IDE setup then. I will give it a try from scratch, following some guide extra carefully.

I literally spent hours on trying to get this to work last night. What made it boggle my mind is that it does find the main entry class successfully (boot class? - not familiar with Java lingo), and tries to run the InventoryEmpty branch - which would hint that my project structure should be correct, as well as manifest etc. It just isn't working. Very frustrating to get stuck with the most simple thing ever.
 
Last edited:
Hexis bots go brrr
Joined
Dec 9, 2016
Messages
4,423
Has your build path changed since your last change? Add a System.out.println("Successful"); and System.out.println("Failure"); in the successTask and failureTask methods to see if your up-to-date code is being called.

If you don't get "Failure" printed in the console when the validate statement is false then your build isn't correct
 
Top