Parentheses (or brackets as you will call them) are used to block code together into sections in MaxScript, it’s very important that they work in pairs.
( must always be followed by ) before the end of the script.
Try making a new MaxScript and running this….
fn a theval =
10 * theval
b = 10
c = a b
You run the script and nothing happens, there is no output in the MaxScript Listener and no error message….
Now try typing this in the maxscript listener….
Press enter and still nothing happens…. Press the escape key and you’ll get the following…
** interrupted **
This should be setting alarms off now that maybe you haven’t got enough parentheses, and if you actually now go and add your extra ) to your code without having pressed the escape key to cause the interruption and try and run it, still nothing happens, so remember if maxscript appears to not be working press escape and see if you can get an interruption.
The Maxscript Editor (assuming you’re in Max 2008+ highlights the matching pair of a parentheses and turns red if it hasn’t got a pair. This is where formatting your code using tabs can be really really useful, when your script gets really really long it’s a giant pain in the ass to find a missing parentheses some times. See below for some examples of how the different formatting can help you find your bug quicker.