I think this is not any kind of news, but is there any idea why the pathfind object crashes when it can not find the path?
Printable View
I think this is not any kind of news, but is there any idea why the pathfind object crashes when it can not find the path?
Have you updated to latest version?
Well I have downloaded build #245 beta and all the bonus packs. The object is v 1.1. The object is cool except the crashes :/
EDIT: Hmm, it crashes when it cannot find the path and still I do this:
Start Loop "loop" Dist("pathfinding object") times.
If I understood right it cannot set that loop because pathfinding object has not find the path and the application crashes?
EDIT 2: Yes, it tries to set loop -1 times and crashes :P
Ok, then it's a bug in mmf..? :) *phew* ;)
I don't think it's a bug of mmf (sorry :D)
The problem with Jarzka's code, was that he was trying to use the result of Dist, asuming that he would always find a path, but if there is no path, the distance returned is -1.
Now, if you just try to find a path to a place where there is no path to, but is not an obstacle, the object crashes..., there is actually an example that comes with the extension pack (I think) that shows that exact bug.
I'm using the pathfinding object right now, and the only work around I found, was to not have that kind of places, you know? if you can't access a specific area of the map, don't just surround it with obstacles, FILL IT with them!
Haora
Haora is right, Im using the object a lot with multiple objects at the same time doing pathes. Make sure you fill out everything that will result in no path with objects to block.
Are you sure you use the 1.1 version of the pathfind extension ?Quote:
Originally Posted by haora
I have it and I have done an example which show all kind of obstacles and there is no crash.
Try this example : Pathfinding example
If the example crashes, you don't have 1.1 version of the extension. ;)
PS: Your problem Jarska is that you start an infinite loop when the object don't find a path. To prevent it start your loop with the "min(0,.......)" function. THanks to that, if a path is not found, your loop will not start (0 loop).
wow sphax I didnt realise you could do that. cool
I did this:
Start Loop "loop" Dist("pathfinding object") + 1 times
It works even the pathfinding object can not find the path. And yes there were no problems at the end of the path :)
min(0,...) is better because you'll not change the Dist value and if the pathfinding extension return -2 or less in some cases, your application will work.
I DO have version 1.1, it says so on the alert box that pops up when I double click on the object.Quote:
Originally Posted by Sphax
But your example (which is the one I was talking about, by the way :D) still crashes, not on the first click though..., but click on that space three of four times in a row, and the program crashes.. at least that's what happens to me...
Haora