Lesson 10: Sorry did you just interrupt m……

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….

print “yes”

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.








About davewortley

Somewhere between an artist and a programmer, I like technical things, but being creative. I love problem solving and coming up with elaborate solutions. This blog is where I shall share ideas, tips, tutorials and anything that amuses me.
This entry was posted in 3dsmax, Lessons. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s