[Closed] Maxscript debug question
Hi,
I’m very new at maxscript and I want to ask you guys a question.
Normally I use regular programming languages like C and C++ and in all kinds of programming enviroments you have the possibility to execute your code line by line even in loops and also you can set breakpoints.
Well it is possible to execute code line by line in th Maxscript listener but it does not work inside of loops and also functions. So if I have a very large for loop with a bug in it (even a logical bug without any kind of error message) it is really hard to figure out where the bug is located… with executing the code line by line and maybe set breakpoints it would be a lot more easy.
So my question is… Is there a possibility to execute code line by line even in loops and functions??
Thanks for your tipps
The technique I use is to put temporary diagnostic commands like print “Line 23” or messageBox “Line 23” at the end of each line in the loop. As far as I know, this is the only way to narrow down when the error is happening.
I’ve never had a bug that I couldn’t track down using this technique. I develop in max 5, so I don’t use the debugger.
Yes. In max 8+ they added a debugger.
If you go to Help -> MaxScript Reference and type in “debugger” in the index they have also included a tutorial which will explain it far better than I would ever hope to.
Wow John? Max 5!!! Good stuff though… I used Max 5 once for a whole year in production, now wait… 2 years. I skipped max 6 altogether… Anyways that was quite a while ago.
You can put break points in the code, but note ‘points’ like other debuggers, but by calling the function ‘break()’. I wrote a chapter in a book by focal press ( a few years ago ) dealing with the debugger. Anyways… you cannot debug line by line by stepping through code. Presently the maxscript lexical anylizer has no concept of lines for files. Anyhow look for improvements in the future though, it’s definitely high up on the list of things TODO.
Chris Johnson
Yep, Max 5. I’m nearly finished with a commercial script for Max 3-9, and Max 5 has offered the ideal balance of newer code-editing features while still exhibiting enough of the older Maxscript bugs/quirks/limitations to help me prepare workarounds early in development. I do 90% of my coding in 5, and then test & code in Max 3/4/6/7/8/9 as needed for version-specific features. Getting it to work in Max 3/4/5 has probably involved 20% of my development time, but it would have been much worse if I’d started in a later version of Max.
More debugging than you could possibly ask for, just type:
“Cuku ()”
in your max script where you want to see what’s going on. Then run your script and look in the listener. Much better than “print variable”. Or at least in Max 9 that might be a new feature too.
hehe. Not exactly an officially sanctioned debugging methodology but it works. Well… it works in max 9.
what should this output?
my max9 just says the same as if I would use “arghh()”.
Georg
arghh() works too. Whenever Max9 Finds a function it doesn’t recognize it dumps every variable currently in memory into the listener when it gives the error message.