PDA

View Full Version : Motion Lscript


ohalldan
08-21-2006, 09:05 PM
Okay so I'm new to Lightwave in general but I do have some programming experience and I am trying to create a Motion Lscript. The script is supposed to turn a wheel on a car the correct amount based on the movement of a car. Of couse my first try isn't working and what I can't figure out is how to debug the code. If I put info() statements inside the process function it gets stuck in the first frame and just keeps repeating the same info statements - it never lets me out to advance the frames. If I put a debug() command in there to bring up the debugger to Watch the variables the same thing happens - I get stuck inside the first frame. Does anybody know how to get around this or how you are supposed to debug a motion lscript if the thing keeps repeating the process function constantly. I also don't understand why it is repeating - I thought it was supposed to run once every time the frame changed - not continually for the same frame. Any advice, suggestions, or help would be greatly appreciated.

-Dan

GregMalick
08-21-2006, 10:35 PM
Put your debug() statement in a routine that is called or in some initialization routine you make. Your Process() routine will get called innumerable times and you don't want the debug() called more than once.

BTW, you don't have to write an LScript for this.
A Rotation based upon the Position would be better served by an expression in the Graph Editor or Relativity (if you have LW9).

Check out http://www.richardbrak.net/tutorials/copter/index.html

Dodgy
08-22-2006, 03:50 AM
Or you could check out the wheel script on my webpage....

ohalldan
08-22-2006, 08:52 AM
Thanks for the replies. I will try moving the debug() statement to a different part and see what happens. I have read over that tutorial you pointed me too but I couldn't get my own expressions to work - and couldn't figure out why - so I figured if I wrote an Lscript at least then I might have the means to debug it by watching the variables.

I will have to try that Wheel plugin too - thanks for the pointer.

ohalldan
08-22-2006, 08:09 PM
So I tried moving the debug() command to a different part of the script and then it just executes once. But when it closes (which it does automatically as I continue to step) and then I go and play with the frame slider - it doesn't come back up anymore - so I can't see what is happening with the variables as the frames advance. Also, putting debug() in part of the program other than process() seems to prevent me from watching any of the local variables inside process() anyway. Any suggestions? Surely somebody has a method for debugging motion lscripts.

ohalldan
08-22-2006, 08:18 PM
Oh yeah Mike I did try your plugin and it works real well so that should at least take care of my wheel rotation problems - but I still can't get motion lscripts to work in general. The other one I was trying to write was to control the turning of the wheels as the car turns - using proper ackerman geometry steering. I guess if anybody knows of a plugin/lscript that already does that - that would be helpful too.

Dodgy
08-23-2006, 03:43 AM
dump
dump() is a debug function; it lets the script developer dump all known internal script variables and their values to a specified text file. That text file, if it already exists, gets appended each time this function is called.

dump(“/myscript.var”);

The dump() command is not supported in the run-time environment. Scripts that contain this command will not compile successfully with the Script Compiler.