MAXScript System Globals

These globals give access to the MAXScript system state. You can access and assign to them as noted.

currentTime

Contains a Time value that defines the current evaluation time in frames as set by the at time context expression currently in force. This is useful in functions that need to do time-relative computations that may be called from code that sets working animation time. If there is no at time context in force, currentTime contains the current user interface slider time, unless a render is in progress. If a render is being performed, currentTime contains the frame being rendered. This variable is read-only.

editorFont

Lets you get and set a String value that defines the font name for script Editor windows. Setting this variable effects all currently open and future script Editor and MAXScript Listener windows. This variable contains the corresponding value set in the MAXScript page of Customize > Preferences.

editorFontSize

Lets you get and set an Integer value defining the font point size for script Editor. Setting this variable effects all currently open and future script Editor and MAXScript Listener windows. This variable contains the corresponding value set in the MAXScript page of Customize > Preferences.

editorTabWidth

Lets you get and set an Integer value defining the tab width (in characters) for script Editor windows. Setting this variable effects all currently open and future script Editor windows. This variable contains the corresponding value set in the MAXScript page of Customize > Preferences.

escapeEnable

Lets you get and set a Boolean value defining whether ESC key interrupt detection is on or off. Setting enableEscape to false turns ESC key interrupt detection off, setting it to true turns it on again. This variable is useful when used in conjunction with a Progress Bar. You can set enableEscape to false when you don't want the user to be able to interrupt a script running a long computation and you have set up a progress bar with its own Cancel button. See Progress Bar Display.

heapFree

Contains an Integer value defining the current amount of free memory in the MAXScript heap. This value will vary constantly depending on where MAXScript is in its collection regime. This variable is read-only.

heapSize

Lets you get and set an Integer value defining the size of the heap currently allocated to MAXScript. MAXScript carves its own working memory (called a heap) out of the memory that 3ds max has allocated. You can add to this heap at any time by assigning the new size to this system variable, as in:

heapSize += 1000000 -- another meg please

See also Memory Allocation and Garbage Collection.

inputTextColor

Lets you get and set a Color value defining the color of typed input text in Listener.

messageTextColor

Lets you get and set a Color value defining the color of error message text in Listener.

outputTextColor

Lets you get and set a Color value defining the color of output text in Listener.

options.oldPrintStyles

The printed form of all basic data value types, except for BigArray, are directly readable by the readValue() and readExpr() functions, making it simpler to read back in values printed to a file by MAXScript. If the pre-3ds max 4 print forms are required for compatibility with existing scripts, you can set this variable to true.

stackLimit

The stack is region of reserved memory in which MAXScript temporarily stores status data such as procedure and function call return addresses, passed parameters, and local variables. This defaults to 1Mb, but you may have certain scripts that contain recursive algorithms that will exceed this limit and so generate a runtime error. You can assign to the stackLimit variable to increase the stack size available.

stackLimit *= 2 -- double the stack

?

A special variable that is used only in the context of the MAXScript Listener. This variable contains the result of the last expression evaluated in the Listener. For more details, see Using the '?' Symbol.