GaetanoH Posted July 21, 2016 Share Posted July 21, 2016 Hello, I'm rewriting my script because I'm using too much WebWalking. WalkingEvent toEdgeBank = new WalkingEvent(edgeBank); toEdgeBank.setOperateCamera(true); toEdgeBank.setEnergyThreshold(50); toEdgeBank.setBreakCondition(new Condition() { @Override public boolean evaluate() { return edgeBank.getRandomPosition().distance(myPlayer()) <= 6; } }).execute(); This is throwing a NullPointer and I have no idea why. Quote Link to comment Share on other sites More sharing options...
Acerd Posted July 21, 2016 Share Posted July 21, 2016 do script.execute(event) , not event.execute() 1 Quote Link to comment Share on other sites More sharing options...
GaetanoH Posted July 21, 2016 Author Share Posted July 21, 2016 (edited) Does "edgeBank" exist? Have you set the Position before running the execute? Area edgeBank = Banks.EDGEVILLE; Thats what I have as a variable for edgeBank do script.execute(event) , not event.execute() That's what I tried before posting this. Still didn't work Edited July 21, 2016 by GaetanoH Quote Link to comment Share on other sites More sharing options...
Precise Posted July 21, 2016 Share Posted July 21, 2016 Area edgeBank = Banks.EDGEVILLE; Thats what I have as a variable for edgeBank That's what I tried before posting this. Still didn't work getBot().getEventExecutor().execute(EVENT_HERE); this one works for me Quote Link to comment Share on other sites More sharing options...
GaetanoH Posted July 21, 2016 Author Share Posted July 21, 2016 Still can't get it to work... Quote Link to comment Share on other sites More sharing options...
Saiyan Posted July 22, 2016 Share Posted July 22, 2016 Still can't get it to work... I may be stupid for saying this but what benefit do you get out of using Area edgeBank = Banks.EDGEVILLE; cant you just set the event area as Banks.EDGEVILLE; without storing it? also after setting the conditions i do execute(eventName); Quote Link to comment Share on other sites More sharing options...
GaetanoH Posted July 22, 2016 Author Share Posted July 22, 2016 When I'm testing it, it seems that it never gets to setting the condition... Anyone an idea how that comes? Quote Link to comment Share on other sites More sharing options...
FrostBug Posted July 22, 2016 Share Posted July 22, 2016 (edited) When I'm testing it, it seems that it never gets to setting the condition... Anyone an idea how that comes? Depends what your code looks like now. In the OP, the snippet posted would throw an nullpointer exception on setting the condition, because of the appended '.execute()'. calling execute on an event always throws NPE, because it is for the EventExecutor's internal use (and the executor sets some vars on the event before calling it). Removing that, there's no way the snippet in the OP can throw an NPE, unless the area is null. Edited July 22, 2016 by FrostBug Quote Link to comment Share on other sites More sharing options...
GaetanoH Posted July 22, 2016 Author Share Posted July 22, 2016 Depends what your code looks like now. In the OP, the snippet posted would throw an nullpointer exception on setting the condition, because of the appended '.execute()'. calling execute on an event always throws NPE, because it is for the EventExecutor's internal use (and the executor sets some vars on the event before calling it). Removing that, there's no way the snippet in the OP can throw an NPE, unless the area is null. Walking to the fishing spot works now, however walking back to the bank doesn't. WalkingEvent toEdgeBank = new WalkingEvent(Banks.EDGEVILLE); toEdgeBank.setOperateCamera(true); toEdgeBank.setEnergyThreshold(50); toEdgeBank.setBreakCondition(new Condition() { @Override public boolean evaluate() { return Banks.EDGEVILLE.getRandomPosition().distance(myPlayer()) <= 6; } }); getBot().getEventExecutor().execute(toEdgeBank); Quote Link to comment Share on other sites More sharing options...
FrostBug Posted July 22, 2016 Share Posted July 22, 2016 (edited) Walking to the fishing spot works now, however walking back to the bank doesn't. WalkingEvent toEdgeBank = new WalkingEvent(Banks.EDGEVILLE); toEdgeBank.setOperateCamera(true); toEdgeBank.setEnergyThreshold(50); toEdgeBank.setBreakCondition(new Condition() { @Override public boolean evaluate() { return Banks.EDGEVILLE.getRandomPosition().distance(myPlayer()) <= 6; } }); getBot().getEventExecutor().execute(toEdgeBank); Nothing wrong with that code as far as I can tell. So it's probably not reached. Try logging Also, in WalkingEvent you can use setMinDistanceThreshhold(6) instead of breaking at a radius of 6 Also, since this is the LocalWalker, make sure the position is actually loaded :E Otherwise nothing's gonna happen. Edited July 22, 2016 by FrostBug Quote Link to comment Share on other sites More sharing options...
GaetanoH Posted July 22, 2016 Author Share Posted July 22, 2016 Nothing wrong with that code as far as I can tell. So it's probably not reached. Try logging Also, in WalkingEvent you can use setMinDistanceThreshhold(6) instead of breaking at a radius of 6 Also, since this is the LocalWalker, make sure the position is actually loaded :E Otherwise nothing's gonna happen. Removing the condition somehow got it working. Gonna try a few more times. Nothing wrong with that code as far as I can tell. So it's probably not reached. Try logging Also, in WalkingEvent you can use setMinDistanceThreshhold(6) instead of breaking at a radius of 6 Also, since this is the LocalWalker, make sure the position is actually loaded :E Otherwise nothing's gonna happen. What do you mean by loading the position? Quote Link to comment Share on other sites More sharing options...
GaetanoH Posted July 22, 2016 Author Share Posted July 22, 2016 I get it. Im using setPath! Thanks all! You can close @Solution! Thanks Quote Link to comment Share on other sites More sharing options...