3ds Max Script controller Errors on file open

max
maxscript

#1

For ages I’ve just dealt with them, but I’ve always wondered, is there any way to figure out where the error is coming from when you open a file and are immediately faced with pop up dialogs showing script controller errors? Nowhere in the dialog can I find a way to determine what exactly is erroring. It’s especially hard when you have multiple errors that are identical that are all depending on something that broke, making it almost impossible to determine which controller goes to which source.

I’ve thought about using the description box to place the name of the node/modifier/etc where the controller is found so if It does blow up for some reason, I can source it.

Anyone else got a better solution, or a way to figure out what’s erroring?


#2

Debug logs man. Log every line of code to file, with a status of what’s going on and what’s supposed to happen next, then use that to trace the error.


#3

I’ve used the debugger. Problem is that it only reports this: Controller:Float_Script. It doesn’t say what that controller is on. Is there any way to query information deeper in the debugger?


#4

I don’t know a neat way to do this, but you get a stack trace of the controller’s variables, right?

You could add a variable to every controller in the scene (should be trivial with getclassinstances), call it something like ‘debug’, then prepend “debug = refs.dependentNodes(this);” to the expression of every said script. Next time when you get the stack trace, at least you’ll see the node causing the issues. When you solve the problem, you can remove the variables and debug line from the start of the expressions, as they will likely be causing quite a slowdown.


#5

Awesome thanks. That works.


#6

I mean, go through your code, and between the lines write the equivalent of: Console.Writeline (“This is supposed to happen now” + thisvariable.ToString());

Then work your way through until you find where the error is coming from

Maybe just the start an end of every function would work as well