3ds Max: A Complete Intro to MaxScript

Maxscript remains one of the more powerful ways to apply customization to 3ds Max. Combining the built-in Listener and editor, we manipulate and test code at runtime, making it a powerful option for users to experiment and explore ways to improve their experience with the software. Through Maxscript, we can manipulate nearly every object inside the software, including but not limited to:

  • Importing/Exporting
  • Materials
  • Rendering
  • Tracks
  • Controllers
  • Animations
  • Modifiers
  • Particles
  • Helpers
  • Lights
  • Cameras
  • Geometry

So, let's dive into it. First, right-click over the pink box located on the lower left of your screen to open the Listener displayed in Figure 1.

Firgure 1

In the Listener window, you'll find a menu "MacroRecorder." The recorder will echo the actions we take in 3ds Max in Maxscript. That is a great tool to learn from or to copy and paste scripts to supplement our actions.

Values and Variables

Like most coding languages, the most common values used when working with Maxscript are floats, integers, and strings. Floats are decimal numbers such as 3.4. Integers are whole numbers such as 1 and 2. Strings are representations of words or a collection of characters, legible or not, and can be alphanumeric, which means they can contain both letters and numbers. Similar to another coding, the value types are essential. For example, adding two floats will return a value representing another float. Adding two integers will return a value representing an integer. If we add a float to an integer, the decimal will ensure a float is returned. Strings are defined with quotation marks such as, "Hello."

Variables are simple to assign in Maxscript. In the white box located on the Listener window, we can type the following: X = 7. That will assign the value of 7 to X. We can type Y = 8 on a second line. Following up, if we type X + Y, the Listener will identify the values accordingly and return the value of 15 demonstrated in Figure 2. Note that Maxscript isn't case-sensitive, so either capital or lowercase X would represent the same value.

Firgure 2

Nodes and Properties

Maxscript provides us access to nodes and properties displayed in the Modifier panel in Figure 3.

Firgure 3

For each of the nodes, there are subclasses. That includes the primary classes, such as geometry or space warps. For example, the Geometry node contains Box, Sphere, Cylinder, etc. So, let's say we want to insert a Box using Maxscript. We define our variable "mybox" and then assign it the Maxscript value to insert a basic box:  mybox = box (). As shown in Figure 4, a box is imported on-screen, maintaining the value "mybox." That allows us to manipulate it as we want.

Firgure 4

If we type the following: showclass "box. *" Maxscript will return the properties we can manipulate. Simply adding the property, we want to modify to the end of our defined variable allows us to later it however we want. See Figure 5, where I increased the length of the box by inputting: mybox.Length = 1000.

Firgure 5


Manipulating the transformations of the objects is relatively simple. For example, we can input the following: move mybox [15,15,15].  That will relocate the box from its current position to 15 units in the x, y, and z axes. To alter the box's coordinates directly, we alter the position property like the following: mybox.position = [0,0,0]. 3ds Max (and most 3D software) uses Euler angles for rotation (rotation in all three axes). That means we need to define rotation for each axis. So, to rotate, we first define our transform: my rotate = Euler angels 0 45 0. Then, we can apply it to the box using: rotate mybox my rotate displayed in Figure 6. Be sure to press enter when defining the rotation variable to log it in the Listener before trying to use the value afterward. Alternately, we can rotate through a single axis by altering the property like the following: mybox.rotation.X = 45.

Firgure 6

We can set the scale of an object similarly: mybox.scale = [50,50,100].  We can scale it up relatively using the following input: scale mybox [50,50,50].


Arrays are essentially a list of multiple elements, helping us to apply processes through all of them. For example, if we type "select lights," Maxscript will select all the lights in our scene. This selection is essentially an array. To create arrays, we can type: my_awesome_array=# ($box001, $box002). That will add boxes 001 and 002 to an array. If we select many objects, we can input "my_awesome_array = selection as an array" to add everything.

Object Sets and Collections

Many objects in 3ds Max can be manipulated using simple commands. For example, we can hide or delete cameras and lights by typing "hide lights" or "delete cameras." Wild cards are used in Maxscript for selection as well. For example, if we want to select all spheres with the name "roundy" in them, we could type the following: select $*roundy*. That will search all objects for the text roundy anywhere inside the names string and select them.


Functions are a collection of actions we want to call in other portions of code. For example, if we want to create a box, have the length and width set to 100, and convert it to a poly object we would define the function as demonstrated in Figure 7.

Firgure 7


There are numerous ways to iterate and repeat code; most use "do, while, if, and for" to accomplish the task. One way to iterate this would be the following script: for I = 1 to 5 do (print I). This will print 1, 2, 3, 4, 5. To iterate over a collection of objects, we can type: for obj in objects do (print That will list the name of every object.

Appears in these Categories