Jump to content

Detect webWalk fail


Recommended Posts

Posted (edited)

I'm trying store a boolean whether webwalk can find a route. I'm doing this right now:

boolean a = getWalking().webWalk(some area);

But it gets stuck for a while, maybe 1 minute before the script continues, even though the console already said that no route is found the moment the line is read. Is there some way to fix this, or some other way to see if there is a route?

 

EDIT: That would be:

getMap().realDistance(some position/entity) == -1

 

Edited by feggit
found the answer
Posted
On 9/26/2018 at 3:51 PM, FrostBug said:

Sure you aren't manually sleeping that minute somewhere? Or returning it from onLoop?

Yes I am sure, because immediately the next line I am printing the boolean and it took a very look time. Don't know why but it works now without any delay.

 

On 9/26/2018 at 10:45 AM, Ragnar Lothbrok said:

Have you tried using a WebWalkingEvent?

Haven't tested this code but off the top of my head you may be able to do something like this:


WebWalkingEvent walkToDestination = new WebWalkingEvent(area);
Event event = execute(walkToDestination);
if (event.hasFailed()) {
	// Event failed do something
}

 

I tried after this suggestion but it didn't work. It turns out that it is WebWalkEvent instead of WebWalkingEvent XD

But it worked after I used the correct class name, so thanks.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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