- Joined
- Dec 23, 2015
- Messages
- 1,104
- Thread Author
- #1
Hi there,
I've been having trouble getting my traversal methods up and running. It's very basic code but it won't run for me in any way.
The error occurs at line "final WebPath bp = Traversal.getDefaultWeb().getPathBuilder().buildTo(coos);" (line 8 in the codefragment)
I tried debugging to see if the coordinates are not recognized but it won't execute anything in the execute function.
This is the log:
I've been having trouble getting my traversal methods up and running. It's very basic code but it won't run for me in any way.
Code:
@Override
public void execute()
{
determineArea();
coos = area.getRandomCoordinate();
System.out.println("Current Coordinates: " + coos); //debug attempt
final WebPath bp = Traversal.getDefaultWeb().getPathBuilder().buildTo(coos);
//final BresenhamPath bp = BresenhamPath.buildTo(area.getRandomCoordinate());
if (bp != null){
if (bp.step(true)){
bot.currentTaskString = "Traversing to" + location;
Execution.delayWhile(Players.getLocal()::isMoving, 1000, 2500);
}
}
}
void determineArea(){
if (location == TraversalLocation.cowArea)
{area = bot.cowArea;}
else if (location == TraversalLocation.jackoArea)
{area = bot.jackoArea;}
}
The error occurs at line "final WebPath bp = Traversal.getDefaultWeb().getPathBuilder().buildTo(coos);" (line 8 in the codefragment)
I tried debugging to see if the coordinates are not recognized but it won't execute anything in the execute function.
This is the log:
Code:
java.lang.NullPointerException
at com.tyb51.CowCrafter.Leafs.TraversalLeaf.execute(TraversalLeaf.java:37)
at com.runemate.game.api.script.framework.tree.TreeBot.onLoop(rab:150)
at com.runemate.game.api.script.framework.LoopingBot.run(zza:221)
at com.runemate.game.api.script.framework.AbstractBot.start(bcb:61)
at nul.iiiiIIiIiiII.run(ikb:203)