Guess who’s back from vacation?

Sorry for the delay on this video: I didn’t expect to be so demolished from 25 hours of flying yesterday.  Anyway, this week is slated with some great videos and great news!

I’ll be showing you how to do some basic automation in 3dsMax’s MaxScript scripting language.  It’s a lot easier than you think and can give you a real edge!  We’ll be looking at how you can manipulate some cubes using simple MaxScript operations, and I’ll show you how to use the Macro Recorder to automate almost any process in 3dsMax.  If you’re looking to get a little more practice with scripting, after the video you can follow my Scripted Clay Rendering tutorial.

I’m also going to get transcriptions for about 10 of my Monday Movies going back a few weeks, so keep an eye out for that.  Special thanks goes out to Devanie at VideoTranscriptions.net for doing a perfect job at…well…video transcriptions.

Transcription

Monday Movie #65: MaxScript Basics
Hello, everyone. Welcome to another Monday Movie. I'm Mr. Bluesummers.
So this week I'll be giving you a quick introduction to MaxScript. For those of you who don't know, MaxScript is the scripting language in 3d Studio Max that allows you to automate just about any process that the program can do. It's a great way to save some time and looks really good on your resume! Let me give you a simple example here. I have 100 cubes that I've created using an array and they're copies of eachother- they're not instances. Now obviously, you'd never do this in real life but let's assume you have 100 objects in 3dsMax that are similar enough that you need to change something in all of them. Maybe "length segments". I might go one cube at a time and type in "length segments = 2, length segments = 2, length segments = 2" and I'll do this for all 100 of them. So I could do that, but I won't. What I can do is tell MaxScript to do this for me in a procedural way for all of these. For example I can select all of [the cubes], and in this pink box right here (and if you can't see it very large, you can adjust it with the slider), I can type:
for cube in selection do cube.lengthsegs = 2
Now let's take a look at this command and I'll show you the basic parts of it. It says "for each object in the selection, call it 'cube' and do the following to each one: set the length segments of 'cube' to 2". Now I've actually memorized this, but I'll show you how to get this kind of command in a second. What that's going to do when I hit enter is for each object in my selection it will object.lengthsegs = 2. I can do this for any one of those segments. I can hit the left arrow key and I'll get my command back so that I can say "cube.heightsegs = 2" and now each of the height segments is equal to 2 as well. In fact, we can get very creative with this. We can say:
for cube in selection do cube.pos.z += random 1 5
And now each cube has been raised by some random amount between 1 and 5. And now you have this awesome, lumpy ground structure. Any aspect of any object can be altered in any way that 3d Studio Max would let you do anyway. Let me show you one more thing before we finish up. If you go up to the MaxScript drop down and you select the MaxScript listener, you'll see two larger boxes similar to the ones you have in the lower-left of the screen. All of these "OKs" are from the commands I just ran, saying "ok, they ran just fine". What you can do is turn on the "Macro Recorder" and this will actually record every action that you do that can be scripted. For example, selecting an object. It says:
select $Box100
because this is Box100. You can use this in your script, and say "oh ok, that is Box100", and now you can type:
$box100.pos.z = 10
To make that box a very specific amount. And there you have it. If you'd like to play around with MaxScript a little more, you can mess around with the Macro Recorder and make more elaborate scripts. Another option is to check out my website and read the scripted clay rendering tutorial, where I have a script that will allow you to take a clay render procedurally.
Mr. Bluesummers: www.MrBluesummers.com.
Thanks for tuning in to another Monday Movie. You can find all of my Monday Movies as well as tutorials, resources, and downloads, on my web site: www.MrBluesummers.com.