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 Legacy Script Editor windows and the Scripting Listener.

Setting this variable effects all currently open and future Legacy Script Editor and Scripting Listener windows.

This variable contains the corresponding value set in the MAXScript page of Customize > Preferences.

The Tabbed Script Editor introduced in 3ds Max 2008 has its own extensive formatting controls documented in the topic Scripting Editor - Properties File Settings and is not affected by this value.

editorFontSize

Lets you get and set an Integer value defining the font point size for Legacy Script Editor windows and the Scripting Listener.

Setting this variable effects all currently open and future script Editor and Scripting Listener windows.

This variable contains the corresponding value set in the MAXScript page of Customize > Preferences.

The Tabbed Script Editor introduced in 3ds Max 2008 has its own extensive formatting controls documented in the topic Scripting Editor - Properties File Settings and is not affected by this value.

inputTextColor

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

messageTextColor

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

listenerBackgroundColor

Gets or sets the background color of the Scripting Listener. When this value is changed, the caret color changes between black and white as necessary to remain visible. Available in 3ds Max 2020 and higher.

macroRecorderBackgroundColor

Gets or sets the background color of the macro recorder pane. When this value is changed, the caret color changes between black and white as necessary to remain visible. Available in 3ds Max 2020 and higher.

macroRecorderTextColor

Gets or sets the color of text in the macro recorder pane. Available in 3ds Max 2020 and higher.

pythonPromptColor

Gets or sets the color of the prompt in the Scripting Listener when it is in Python language mode. Available in 3ds Max 2020 and higher.

macroRecorderSelectionForegroundColor

Gets or sets an override color value for selected text in the macro recorder. A value of 'undefined' means the default setting is used. Available in 3ds Max 2020.1 Update and higher.

macroRecorderSelectionBackgroundColor

Gets or sets an override background color value for selected text in the macro record. A value of 'undefined' means the default setting is used. Available in 3ds Max 2020.1 Update and higher.

macroRecorderSelectionAlpha

Gets or sets an override alpha channel (translucency) for selected text (foreground and background) in the macro recorder. This value is in the range of 0 to 255. A value of 'undefined' means the default setting is used. Available in 3ds Max 2020.1 Update and higher.

listenerSelectionForegroundColor 

Gets or sets an override color value for selected text in the Scripting Listener window. A value of 'undefined' means the default setting is used. Available in 3ds Max 2020.1 Update and higher.

listenerSelectionBackgroundColor 

Gets or sets an override background color value for selected text in the Scripting Listener window. A value of 'undefined' means the default setting is used. Available in 3ds Max 2020.1 Update and higher.

listenerSelectionAlpha 

Gets or sets an override alpha channel (translucency) for selected text (foreground and background) in the Scripting Listener window. This value is in the range of 0 to 255. A value of 'undefined' means the default setting is used. Available in 3ds Max 2020.1 Update and higher.

outputTextColor

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

EXAMPLE

editorShowPath

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

This property affects both the Legacy Script Editor windows and the Tabbed Script Editor introduced in 3ds Max 2008.

editorTabWidth

Lets you get and set an Integer value defining the tab width (in characters) for Legacy Script Editor windows.

Setting this variableaffects all currently open and future script Editor windows.

The Tabbed Script Editor introduced in 3ds Max 2008 has its own extensive formatting controls documented in the topic Scripting Editor - Properties File Settings and is not affected by this value.

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.

In 3ds Max 9 and higher, the default value of this variableis false . It used to be true in versions prior to 3ds Max 9.

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.

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

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,

FOR EXAMPLE

   heapSize += 1000000-- another meg please

See also Memory Allocation and Garbage Collection.

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

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 Max4 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.

In 3ds Max 9 and higher, the stack limit is 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 Scripting Listener.

This variable contains the result of the last expression evaluated in the Listener.

For more details, see Using the '?' Symbol.