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:

foo

bar123

this_is_a_very_long_identifier

_heresOneWithStudlyCaps

The following names are not valid:

1object            First character not an alphabetic character

pressed?           ? is not a valid alphanumeric character

a big number       spaces not allowed in names

seven(7)           ( and ) are not valid alphanumeric characters

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:

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

See also

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]