Unhandled exception errors, A* pathing
Moderators: Murderator+, Murderator
Unhandled exception errors, A* pathing
Redacted
Last edited by Praxiiz on 2016-11-18 08:52:30, edited 1 time in total.
i can not check your whole script, but will do some suggestions
1) author of script module said somewhere that it is guaranteed that file will be open and working only once per script life; so most scripts using files open some file then closing it once.
2) try to use uo.Set/GetGlobal to store your data. Example
uo.SetGlobal("myXval"+str(counter),str(tempX))
uo.SetGlobal("myYval"+str(counter),str(tempY))
keep in mind, stored value is a text, so do convertation if needed
tempX=VAL(uo.GetGlobal("myXval"+str(counter))
3)
if (temp == destination ) then
done = 1
uo.print("DONE!!!")
Often there is no need, or there is no possibility to reach exact point.
Make your task finished if distance to target exact or lesser then given Accuracy (accuracy=0 mean exact point)
4) i see no movement subs, so i can not know did it done already or no, but you must know that this must be treated in your script logics:
- uo client is not answerinf movement keystrokes immediately, so in case of lag or just small delay in some moment client may process not keypress you think it do, but some of previous ones.
- uo client have buffer for 2 movement steps.
- you may ask client to do step in some direction, but if it is blocked client may not stop but do step in other direction.
- maybe it is not bad idea use timer to not allow script seek for path ethernaly
- don't forget to check out available stamina before moving
5) i myself started to work on A* before project frozen so i interrested in your results. if you want some tips or just willing to talk about uo pathfinding try use my icq#139629504
1) author of script module said somewhere that it is guaranteed that file will be open and working only once per script life; so most scripts using files open some file then closing it once.
2) try to use uo.Set/GetGlobal to store your data. Example
uo.SetGlobal("myXval"+str(counter),str(tempX))
uo.SetGlobal("myYval"+str(counter),str(tempY))
keep in mind, stored value is a text, so do convertation if needed
tempX=VAL(uo.GetGlobal("myXval"+str(counter))
3)
if (temp == destination ) then
done = 1
uo.print("DONE!!!")
Often there is no need, or there is no possibility to reach exact point.
Make your task finished if distance to target exact or lesser then given Accuracy (accuracy=0 mean exact point)
4) i see no movement subs, so i can not know did it done already or no, but you must know that this must be treated in your script logics:
- uo client is not answerinf movement keystrokes immediately, so in case of lag or just small delay in some moment client may process not keypress you think it do, but some of previous ones.
- uo client have buffer for 2 movement steps.
- you may ask client to do step in some direction, but if it is blocked client may not stop but do step in other direction.
- maybe it is not bad idea use timer to not allow script seek for path ethernaly
- don't forget to check out available stamina before moving
5) i myself started to work on A* before project frozen so i interrested in your results. if you want some tips or just willing to talk about uo pathfinding try use my icq#139629504
Pathfinding
Since my last post, I wrote a couple programs in C++ to handle writing the coords to files. The programs do exactly what the above file handling subs do. Now the script runs fine without the unhandled exception errors.
For example, I can use the following code to pathfind:
uo.launch("pathfind.exe", "5502 567 5501 572")
and it will output the same finalstack.dat file as I mentioned in my above post. Then reading it into injection isn't hard.
The problem I have now is the list of walkable coords that my pathfinding algorithm sorts through. At the moment I mapped out the first level of despise and have a list of coords to pathfind with, but it took me a few hours. The pathfinder works fine with those, but I don't really feel like mapping out the rest of Brittania.
Does anyone know the format that the *.mul files use? It would be really nice if I could just read the walkable coords right out of the map and statics files. Or write a program that would extract them.
I can post my c++ code if anyone is interested.
For example, I can use the following code to pathfind:
uo.launch("pathfind.exe", "5502 567 5501 572")
and it will output the same finalstack.dat file as I mentioned in my above post. Then reading it into injection isn't hard.
The problem I have now is the list of walkable coords that my pathfinding algorithm sorts through. At the moment I mapped out the first level of despise and have a list of coords to pathfind with, but it took me a few hours. The pathfinder works fine with those, but I don't really feel like mapping out the rest of Brittania.
Does anyone know the format that the *.mul files use? It would be really nice if I could just read the walkable coords right out of the map and statics files. Or write a program that would extract them.
I can post my c++ code if anyone is interested.
Looks like I found the *.mul format
I found the *.mul file format. If anyone is interested it can be found here:
http://www.wpdev.org/docs/formats/csharp/default.html
http://www.wpdev.org/docs/formats/csharp/default.html