Jump to content

WalkingEvent problem


GaetanoH

Recommended Posts

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.

Link to comment
Share on other sites

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 :s

Edited by GaetanoH
Link to comment
Share on other sites

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 by FrostBug
Link to comment
Share on other sites

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);
Link to comment
Share on other sites

 

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 by FrostBug
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...