Entering Information into MAXScript

There are several different types of information that you will typically want to enter into the Scripting 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. (The RETURN key is often labeled as "Enter" on some keyboards. It is the large key at the right side of the main keyboard area).

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.

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 Scripting Listener window open, say hello to MAXScript:

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