feggit Posted September 26, 2018 Share Posted September 26, 2018 (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 September 26, 2018 by feggit found the answer Quote Link to comment Share on other sites More sharing options...
Ragnar Lothbrok Posted September 26, 2018 Share Posted September 26, 2018 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 } Quote Link to comment Share on other sites More sharing options...
FrostBug Posted September 26, 2018 Share Posted September 26, 2018 Sure you aren't manually sleeping that minute somewhere? Or returning it from onLoop? Quote Link to comment Share on other sites More sharing options...
feggit Posted September 28, 2018 Author Share Posted September 28, 2018 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. Quote Link to comment Share on other sites More sharing options...