therkyn
Mar 7 2007, 04:33 PM
Hi All,
So, this has always been an ongoing thing. Wait Event recursion. Yep, it means I messed up somewhere. It seems to be a relatively rare item, but usually I get caught up while I'm using SkunkNav.js to get me somewhere. I have read that I should be able to incorporate VBScript into my project and utilize xnav instead of skunknav, but all of my attempts have failed to integrate the two.
So, my question is, what can I do to monitor for waitevent recursion and have it break out and restart itself. I guess ultimately, I'd love it if I could figure out where it was recursing so I could FIX the original problem instead of band-aiding it by simply resetting things. So any thoughts on either goal would be helpful. Also, I'm not sure that xnav would solve the problem, it may simply be a sign of my recursion problem and not really related to movement.
Thanks,
-t
P.S. Boy, after using try-catch statements in my writing of text to the hard-drive for years, I finally thought to put it elsewhere and stopped my other random crash problem... dunno why I never did it sooner. Maybe I should try learning the VBScript method of coding and give up my acscript ways...
GKusnick
Mar 7 2007, 04:55 PM
WaitEvent recursion happens whenever you call WaitEvent (directly or indirectly) from inside an event handler. If the recursion level keeps climbing, that's generally a sign that your code is responding to user-level commands by calling into some long-running function directly from the event handler. For instance if the user says Buff, or Go there, or whatever, and you immediately call directly into your buffing or navigation code, then you're vulnerable to recursion because more commands could come in while that previous command is still in progress.
The usual remedy for this is to have your event handler save the command in a global and then return. In your main loop, after WaitEvent returns, you can then check the global and carry out any pending commands. This guarantees that only one command executes at a time and that you're not digging yourself into an ever-deeper recursion pit.
On the Xnav-v.-SkunkNav thing, I don't think it matters all that much. If you're comfortable with SkunkNav, there's no pressing reason to change over (unless you need the new features in Xnav), and I doubt it would have much effect on your recursion issue.
therkyn
Mar 7 2007, 05:49 PM
Yep, I thought I'd eliminated all of those bad habit things (I think we discussed this once about 2 years ago) of calling a procedure from inside an event. I'll go take another gander and see what I find.
Thanks,
-t
PS DOH, found it. When I get a navstop error I'm asking it to resume the route, but that's a skunknav function; so I'm calling an external loop that is relatively long... I'll have to figure out how to set that global and check for it. Thanks!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.