Entering Information into MAXScript

There are several different types of information that you will typically want to enter into the MAXScript Listener window. These include numeric values, strings, and arrays.

Information is generally entered into MAXScript by typing a value or expression and pressing the numeric ENTER key, or the alternative key combination SHIFT+RETURN.

However, each type of information must be entered in a slightly different way.

Entering Numbers in MAXScript

MAXScript distinguishes between two types of numbers: integers and floats. An integer is a whole number, such as 0, 1, 2, 10, 527. Floats are floating-point numbers and contain decimal points, such as 2.5, 72.0, and 0.33.

When MAXScript performs numerical operations, the result is generally the same number-type as the arguments in the operation. For example: 3 + 4 will return 7, while 3.0 + 4.0 will return 7.0.


When MAXScript performs operations involving both float and integer-type numbers however, it treats the integer as a float number. For example: 3 + 4.0 will return 7.0.


Entering Strings in MAXScript

MAXScript is an expression-based language. All of its constructs yield a value. Strings are MAXScript constructs, and they are entered inside quotation marks. The command output for a string, meaning the value a string yields in MAXScript, is the string itself.

With the MAXScript Listener window open, say hello to MAXScript:

  1. At the prompt, type Hello and press ENTER on the numeric keypad.

MAXScript answers with undefined. This is called command output, which always appears in blue. The reason for this specific output is that MAXScript doesn’t know the word Hello. It is not defined in the language and therefore MAXScript cannot determine what to do with it.


  1. Write the word "Hello" again, this time with quotation marks, and press ENTER.

The command output is now "Hello".

It seems that MAXScript knows the string "Hello" because it answers with a friendly "Hello" Actually, it merely knows that you entered a string, and the command output for strings is always the value of the string you entered.


Entering Arrays in MAXScript

You can use an array to group several elements into one collection. An array is an ordered collection of values. In MAXScript, each element in the array can contain any type of value, and all of the elements can be accessed individually.

An array can be expressed in two forms. The first is:


This is the most basic type of array: an empty one. It is important to note that all arrays must be defined with the number character (#) and a pair of parentheses.

#( <expr> , <expr> )

This form of the array is appropriate when you would like to define one or more of the initial elements within the array. Each value of <expr> can be a number, an expression (e.g., sin pi, 6.2^3), or a string (e.g., "hello"). Elements do not have to be the same type of information, and there is no limit on the number of elements you can have in an array.


Next Topic

Assigning Variables