Names

Names are used in MAXScript to identify variables, functions, parameters, properties, and so on. Names start with an alphabetic character or "_" (underscore), and can contain any number of alphanumeric characters or "_".

EXAMPLES OF VALID NAMES ARE:

THE FOLLOWING NAMES ARE NOT VALID:

In contrast to most general purpose programming languages, MAXScript names are not case-sensitive. For example,the names in the following list refer to the same variable in MAXScript:

BitMapTexture
bitmaptexture
BITMAPtexture

In syntax descriptions, name identifiers are specified as:

<var_name>

An example of a syntax where a name identifier is specified is:

for <var_name> ( in | = )<sequence> ( do | collect ) <expr>

In this example, <var_name> specifies the for loop variable.

A name in a program is always interpreted as the name of a variable or parameter and it effectively stands for the current value of that variable or parameter in any expression in which it is used.

FOR EXAMPLE, CONSIDER THE FOLLOWING SCRIPT:

   i=10
   j=i+5
   print j

In this script, i and j are variable names. In the first line, the value 10 is assigned to variable i . In the second line, the value 5 is added to the value stored in variable i , and then the result is stored in variable j . In the third line, the value 15 is printed, which is the value stored in variable j .

MAXScript also allows you to work directly with names as values at runtime, as you can with numbers and strings. To write a name value in MAXScript, you preface the name with a "#":

#<var_name>

In syntax descriptions, name values are specified as:

<name>

Name values are primarily used for symbolic parameters in function calls, and many of the built-in functions use them as such. The allowed values specified for symbolic parameters are defined by the function, and are documented with the function.

As an example, consider the setBeforeORT() function. Its syntax is:

setBeforeORT <controller> <ORT_type_name>

Sets the Out-of-Range (ORT) type for the controller for the time before the first key. The <ORT_type_name> must be one of the following name values:

#constant #cycle #loop #pingPong #linear #relativeRepeat

AN EXAMPLE USAGE OF THIS FUNCTION IS:

   setBeforeORT $box01.position.controller #pingPong

Name values can also be used as an index in certain Collections.

FOR EXAMPLE,

the index for a ModifierArray can be an integer, name, or string:

   -- access modifier on object loft01 called Optimize:
   $loft01.modifiers[#Optimize]

Quoted Names

Names set in single quotes allow you to write names that contain illegal identifier characters, such as spaces and other punctuation. They are primarily intended for specifying 3ds Max object classes and properties that have special characters in their names.

The form is:

'<any_char_except_quote>' -- for an identifier or property name
#'<any_char_except_quote>' -- for a name literal
'<any_char_except_quote>': -- for a keyword parameter label

EXAMPLES:

   snow 'starttime(start)':5
   b.'lifetime(life)'
   $box01.modifiers[#'FFD 4x4x4']

Spaces in Names

Because of the large amount of names in 3ds Max that include spaces, the underscore character (" _ ") can be used instead of a space in a name.

The following is equivalent to the last line of the above example:

   $box01.modifiers[#FFD_4x4x4]