Maxscript Tutorial
Maxscript Tutorial
3dsMAXScript Tutorial
TUTORIAL OUTLINE
what is MAXScript?
an introduction
3ds MAXScript
interface
F11
- VALUE
- PARAMETER
- VALUE
- PARAMETER
- VALUE
- PARAMETER
INPUT TEXT:
OUTPUT TEXT:
- OBJECT NAME
- PATH NAME
expressions
Input text - expressions, sub-expressions,
controllers, functions, notes or identifying
text
Output text - result of executed expression
Error text -notification of failed input
CONTROLLER
INPUT TEXT:
ERROR TEXT:
- PARAMETERS
INPUT TEXT:
EXECUTION TEXT:
- NAMED OBJECT
- ACTION/FUNCTION
FUNCTION ARGUMENT
FUNCTION
basic scripting
arrays
Arrays are an ordered collection of
values in MAXScript used to group
multiple strings or elements into one
expression.
Elements contained in arrays can be
any type of value and multiple value
types can be used in one array.
A basic empty array:
#()
creating primitives
objectname
objectname
parameters
transform in script
Using the handle the specific objects properties can be accessed easily.
mybox.height
40.0
mybox.length
40.0
mybox.width
40.0
To change the name:
mybox.name = greenbox
To change the color:
mybox.wirecolor=(red,orange,yellow,green,blue,brown,black,white)
or
mybox.wirecolor=(color 255 0 255)
To change the position:
The position is expressed as the X, Y, Z coordinates.
mybox.pos = [0,-75,0]
To change the size:
The scale property requires a scaling factor for X, Y, and Z axes
mybox.scale = [1,1.5,1]
MAX reads scale box 100%,150%,100%
Note: parameters do NOT change, just MAXworld scale
10
11
assigning modifiers
13
14
The next step to create more complex or multi faceted scripts is to utilize the MAXScript Editor. The MAXScript Editor is located
under the MAXScript tab.
MaxScript Listener vs. Max Script Editor
MaxScript Listener if for executing or evaluating one set of information at a time
MAXScript Editor can contain multiple scripts and evaluate them in sections or as one complete script
Scripting language is color coded to assist in the organization of the code.
Comments - Green
Events (such as on, if, or while) - Blue
Text strings - Dark Red
The rest of the script remains black.
15
SEARCH COMMANDS
CTRL+Right-Click
Displays a pop-up menu of all the utility, structure, userinterface item, function, handler, plug-in, tool, Macro Script,
and rcmenu definitions that exist in the current script.
CTRL+B
Selects the text in the current bracket. Bracket balancer lets
you check bracket balancing in long bits of code. The balancer
works with any of the following: (), [], and {}. To use it, place the
cursor anywhere in the script text and press CTRL+B. I
CTRL+D
Performs a simple syntax coloring scheme in the MAXScript
Editor. Each time you press CTRL+D, the window is redrawn
with comments in green, MAXScript reserved words in blue, and
string literals in dark red.
CTRL+R
Places the cursor at the location where it was previously placed
with a mouse click or a find operation. Consecutive uses of
CTRL+R cycle through the last eight cursor positions. This
feature is useful if you edit at one location, move the cursor
elsewhere with find or scroll operations, and then want to
return to the edit location.
CTRL+J
Opens a modal Go To Line Or Character dialog which lets
you enter a line and/or character position to jump to. This
feature could be used for example with the line and character
numbers found in the output of the Debugger or in an error
message in the Listener in 3ds Max 8 and higher. The default
values in the dialog will be set to the current cursor position.
MAXScript Editor Commands. Web log post. CG PLUS. N.p.,
n.d. Web. 06 Dec. 2012
17
Condition Statements
MAXScript is used to create a series of actions and a set
of rules for how 3dsMAX will execute those actions.
These rules are set up in commands that allow you to
control the path that the software follows it evaluates
your script. The two most useful groups of commands
are the conditional statements and loop statements.
Conditional statements simply tell MAXScript to perform
a specified command if a certain condition is met.
if mybox.height == 10
Ex.
if mybox.height == 10 then mybox.width = 20
To add another layer of information or function an if
then statement can be expanded to include an else
statement.
In addition to color, MAXScript uses numbered lines to
help organize scripts. Commands can be broken up over
several lines and tabs or indentations can also be used
to make functions more clear.
Comments/notes can be added within scripts as long
as they appear in quotes
The double equal sign in the last statement, == tells
MAXScript to compare two values.
The single = sign always signifies assignment.
18
== equal to
!= not equal to
> greater than
>= greater than or equal to
< less than
<= less than or equal to
thenmybox.width = 20
20
21
Cantrell, Bradley, and Natalie B. Yates. Modeling the Environment: Techniques and Tools for the 3D Illustration of Dynamic
Landscapes. Hoboken, NJ: Wiley, 2012. Print.
Cantrell, Bradley, and Wes Michaels. Digital Drawing for Landscape Architecture: Contemporary Techniques and Tools for Digital
Representation in Site Design. Hoboken, NJ: John Wiley & Sons, 2010. Print.
Cropp, Audrey M. From Digital Memory: A Cloud for Our Cultural Heritage. Thesis. Robert Reich School of
Landscape Architecture, Louisiana State University, 2012. Baton Rouge: n.p., 2012. Print.
Danziger, Michael. Information Visualization for the People. Thesis. Massachusetts Institute of Technology, Dept. of Comparative
Media Studies, 2008. N.p.: n.p., n.d. Print.
IMAGINE DESIGN CREATE: How Designers, Architects, and Engineers Are Changing Our World [Hardcover]. IMAGINE DESIGN
CREATE: How Designers, Architects, and Engineers Are Changing Our World: Tom Wujec: 9781595910660: Amazon.com: Books. N.p.,
n.d. Web. 29 Nov. 2012. <http://www.amazon.com/IMAGINE-DESIGN-CREATE-Designers-Architects/dp/1595910662>.
Khaslavsky, Julie, and Nathan Sherdoff. Understanding the Seductive Experience. Communications of the ACM May 1999: n. pag.
ACM Digital Library. Web. 29 Nov. 2012.
MAX Script 101. Dir. John Wainwright. Perf. John Wainwright. Vimeo, 2011. Online Video Tutorial.
Murdock, Kelly. 3ds Max Bible. Hoboken, NJ: Wiley, 2008. Print
NRCS. Conservation Plant Releases - Golden Meadow Plant Materials Center. Conservation Plant Releases. Natural Resources
Conservation Service, 09 Nov. 2012. Web. 29 Nov. 2012. <http://plant-materials.nrcs.usda.gov/lapmc/releases.html>.
Treib, Marc. Representing Landscape Architecture. London: Taylor & Francis, 2008. Print.
USDA. PLANTS Database. USDA PLANTS. United States Department of Agriculture, n.d. Web. 29 Nov. 2012. <http://plants.usda.
gov/>.
USDA. Wetland Indicator Status. 2012 National Wetland Plant List. United States Department of Agriculture, 2012. Web. 29 Nov.
2012. <http://plants.usda.gov/wetland.html#subregions>.
41