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.

editorShowPath

new.gif NEW in 3ds Max 9: This system global variable controls whether the MAXScript Editor will display the full path of the edited script (true, default in 3ds Max 9), or only the file name (false, the only mode prior to 3ds Max 9).

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.

new.gif NEW in 3ds Max 9: The default value of this variable has been changed to false. It used to be true in previous versions of 3ds Max.

heapFree

Contains an Integer64 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.

new.gif NEW in 3ds Max 9: The value type of this variable has been changed from Integer to Integer64 to accommodate the increased memory space of 64 bit systems.

heapSize

Lets you get and set an Integer64 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.

new.gif NEW in 3ds Max 9: The value type of this variable has been changed from Integer to Integer64 to accommodate the increased memory space of 64 bit systems.

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.

options.showGCStatus

When set to true, the message "MXS GC" will be displayed in the status bar during MAXScript Garbage Collection. When set to false, no message will be displayed. The setting is stored in the 3dsmax.ini file in the [MAXScript] section. Available in 3ds Max 8 and higher.

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.

In versions prior to 3ds Max 9, this defaulted to 1024000 bytes. Certain scripts that contain recursive algorithms could exceed this limit and generate a runtime error. You could assign to the stackLimit variable to increase the stack size available.

new.gif NEW in 3ds Max 9: In 3ds Max 9, the stack limit has been increased to 2048000 bytes but you cannot effectively change the size anymore. Assigning to the stackLimit variable will not change the stack size.

?'

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.