The following is a synopsis of the main sections in
the MAXScript 101 video course:
The courseware video is now available for free viewing on Vimeo at this link: MAXScript 101 video
The example scripts mentioned in the video are available for download here: sample-scripts.zip
1.1 MAXScript 101
Introduces the course and explains what scripting
is and how MAXScript is generally used within 3ds max.
1.2 Accessing MAXScript
Describes how MAXScript turns up in 3ds max, introduces
the MAXScript menu and describes the MAXScript Listener, which is the
main MAXScript command line window. It shows how to use the Listener
for interactive scripting and introduces the Mini-Listener in the MAX
1.3 Scripting Fundamentals
Introduces several key initial MAXScript concepts
through a series of simple one-line commands, run in the Listener. Shows
how these can be bundled into a script that can do several things in
one go, and shows how the script can be saved and run in various ways,
such as in the Listener, from a file on disk, or via a MAX toolbar button.
Introduces the MAXScript online help and shows how to call it up interactively.
1.4 Introduction to Sequencing Constructs
Introduces the key ways you can control sequencing
in a script, so that different parts of a script can be run depending, for example,
on what is currently in the scene. Shows how to use "loops"
to repeat parts of a script any number of times, a critical mechanism for
performing complex repetitive tasks with the scripter. Introduces the use
of mathematical expressions in scripts.
1.5 Introduction to UI Scripting
Shows how to wrap a script in a dialog-based user
interface, with spinners, buttons, checkboxes, etc., so that it can be called
up and used by any MAX user. Introduces Script Editor windows, used
to build and edit larger scripts.
1.6 Introduction to Code Layout and Syntax
Presents recommended ways to layout and comment your
scripts as they get larger, to help keep them manageable. Shows tricks
to use in the Listener and Script Editor windows to help automatically
layout script code. Inroduces "syntax rules", used in the
MAXScript document to specify the format of scripts, and gives examples.
2. Script Building Blocks
Returns to scripting fundamentals, exploring in detail
the main building blocks you use to write scripts.
2.1 Names and Variables
Explains how names and variables are used in scripts
to identify items and store values. Describes the difference between
global and local variables and the way in which nested namespaces are
are set up in scripts to define the contexts in which names and variables
2.2 Code Blocks
Introduces the simplest and most common form of script-structuring,
the code block. Shows how more complex scripts are built up simply from
nested code blocks, with several examples. Explains how local variable
namespaces are automatically set up to match code block structure.
Introduces the other main script-structuring mechanism,
function definition. Shows how you can factor common pieces of code
into a single function definition, and how to add your own functions
to the library of built-in functions that MAXScript already provides,
through a number of step-by-step examples. Explains how to make functions
general-purpose through function parameters and how to use "recursive"
functions to easily process nested structures like the MAX scene parent-child
2.4 Values and Classes
Describes how all the various kinds of values you
can work with in MAXScript are organized into a manageable "class
hierarchy". Shows how to find the class of a value and how to search
for new classes added by 3rd-party MAX plugins. Describes the MAX object
hierarchy, and how common operations are arranged in this hierarchy
to make it easy to find how to work with the various object types. Introduces
the "interface" mechanism, recently added to MAX to make more
Explores in more detail the various kinds of expressions
you can use in MAXScript, including math expressions, comparisons, logical
expressions and so on. Shows how you write them and explains the notion
of operator-precedence which determines the order of expression evaluation.
Describes special operators like operator-assignment, property access,
and type conversions, all through numerous examples.
2.6 Collections and Arrays
Shows how you use MAXScript to work on collections
of things, like scene object sets, arrays of numbers, and so on. Describes
the Array class, used for making your own sets of values. Shows the
various loop features in MAXScript for processing and building collections
and arrays. Gives examples for searching the scene for objects with
certain characteristics and building the equivalent of named selection
sets in MAXScript. Presents an improvement of the sphere-creator example
using arrays to make it highly-interactive. Shows another example of
a recursive function that builds an array of objects by following the
scene parent-link hierarchy.
2.7 Naming Scene Objects
Shows how to refer to MAX scene objects within scripts,
both individually and as collections. Presents the built-in object sets,
like geometry, lights, cameras and so on, and how to name custom collections
based on wild-card name patterns. Introduces the "pathname",
a way to name objects in the scene relative to their place in the parent-link
hierarchy. Shows how to use loops and automatic-collection-mapping to
process these collections very easily within scripts.
3. Scripting Tasks
Explores in detail some of the common tasks you perform
3.1 Scripting Animation
Describes automatic keyframe scripting using the animate
and at-time context prefixes, which mimic the auto-key button and time
slider in the MAX user interface. Shows how to work with time in MAXScript
for controlling animation, doing across-time calculations and sub-frame
manipulation. Explains the dynamic-scoping of context prefixes. Presents
several extended animation examples that include useful tricks for scripting
animation based on multiple spline curves.
3.2 Working with Controllers
Presents low-level animation scripting, working with
individual controllers and keys. Shows how to make and assign controllers
to MAX object parameters and how to instance and copy them around. Explains
how to add keys and set their values and times and other properties.
Presents an extended example that builds position keys on a camera based
on placement & orientation data read from an external data file.
In the process, introduces file I/O in MAXScript. Describes how many
of the controller and keys functions in MAXScript can operate automatically
on nested controllers.
3.3 Working with Modifiers
Shows how to build and manipulate modifiers stacks
on scene objects within scripts, constructing and adding modifiers and
setting up their parameters. Presents an example script that automatically
adds and keyframes a bend modifier to cause a cylinder to bend and follow
a flying object.
4. More Bulding Blocks
Returns once again to scripting fundamentals, rounding
out the set of script building blocks you should be familiar with.
4.1 Loops and Loop Control
Presents the while-loop via an extended example, and
describes various loop control commands like continue, exit and return.
4.2 Case Expressions
Presents the case-statement, a generalization of the
if-statement for scripting complex conditional code. Presents a more
general version of the LOD script example.
4.3 More Context Prefixes
Describes two further context prefixes that let you
set up common default coordinate systems and scale/rotation centers
for large sections of code. Shows examples of how to simply script object
transformations in various coordinate systems such as object-local,
parent, grid, scene, world, and so on.
5. Example Scripts
At this point, a workable grounding in MAXScript has
been presented, enough to allow substantial scripts to be written. This
section presents walk-throughs of several rather larger scripts showing
how the building-blocks work together and presenting several common
patterns you can use in your own scripts.
5.1 ChainMaker Geometry Creation using Splines
A tool for making interlinked chains that follow a
selected spline curve in the scene, with settings for link diameter,
thickness and color. Presented in two versions, the latter being enhanced
to perform interactive update of the chain as the parameter spinners
are twiddled. Shows more spline-interpolation techniques, advanced rollout
scripting, use of coord system contexts and pick-button filter functions.
5.2 Aside Adding Scripted Items to MAX Menus and Toolbars
Shows how to extend the MAX user-interface by adding
the chainMaker script to a newly-made menu in the main MAX menubar.
Introduces macroScripts and how they can be used generally to extend
the MAX command set.
5.3 ExportMesh Writing Custom Scene Exporters
A function for generating a custom export file containing
frame-by-frame vertex position data for a given animated mesh. Introduces
mesh-vertex accessing functions and external file creation and output.
5.4 Aside Debugging: Finding & Fixing Script Errors
Uses the ExportMesh example to demonstrate several
different kinds of script errors, how you would find and correct them.
Describes syntax errors, runtime errors and logic errors and explains
how to read error messages and "stack" traces. Presents several
techniques to help debug script errors.
5.5 Export Folder, ThumbnailFolder Processing Sets of Scene Files
An example that processes whole directories of scene
files, not just individual objects in the current scene file. Two versions
of the example are presented, one for automatically generating .3DS
exports of a set of .max files in a given folder, another for generating
.jpg thumbnail renderings of all the scene files in a given folder.
Shows directory processing and scene file opening and closing. Introduces
the built-in render function which gives scripted access to the full
power of the MAX renderer.
5.6 TreePlanter Scene Generation using Mesh Sampling
A full walk-through of the script used in the trees-placed-along-a-windy
road example from the beginning of the presentation. Shows how to use
loops for procedurally generating very large numbers of scene objects,
further spline interpolation techniques, and introduces the intersectRay
function which is is extremely useful for scripts that place objects
on or sample complex surfaces.
5.7 Aside Using Visual MAXScript
Wraps the TreePlanter script in a dialog window with
pickbuttons and spinners to control tree placement, this time using
the Visual MAXScript tool in MAX that lets you interactively layout
and edit scripted dialogs, much as in Visual Basic.