The MAXScript Listener Window

The Listener

The MAXScript Listener window is an interactive interpreter for the MAXScript language. MAXScript commands entered in this window are executed immediately when you press the ENTER key.

Note: The MAXScript Listener also supports Python commands. You can switch to Python mode by selecting the Python radio button. The Python mode is indicated by a >>> prompt. For more information, see the 3ds Max Python Help.

The Listener window is appropriate for performing interactive work and developing small code fragments. Extended blocks of code should be developed in a Script Editor Window.

Each command you execute in Listener is actually an expression with a result which the Listener prints out after each execution.

All commands in MAXScript are expressions or function calls that can look like commands in other languages. The terms command and expression are synonymous in MAXScript.

You can enter any MAXScript expression or sub-expression in Listener for evaluation, and Listener prints out its result.

You can open only one instance of the MAXScript Listener window at a time.

You can open the MAXScript Listener in one of the following ways:

The Listener window is a resizable, modeless window. You can switch between it and 3ds Max as you work. The Listener retains any text it contains when it is closed and opened again.

If Auto Open Listener on Output is checked in Customize > Preferences > MAXScript, the Listener window opens automatically when a script outputs to it.

The Listener is divided into two panes: the top (pink) pane is the Macro Recorder pane, and the bottom (white) pane is the output pane.

When the Macro Recorder is enabled, everything recorded is displayed in the Macro Recorder pane.

The output of results from scripts are displayed in the output pane.

The output of code executed in the Macro Recorder pane is always directed to the output pane so as not to clutter the recordings.

Both panes allow you to cut-and-paste, drag-and-drop, edit, select, and execute code.

You can resize the panes by dragging on the split bar between them.

To install the Listener into a viewport:

1. Click or Right-Click the viewport type label.

2. Choose Extended Viewports.

3. Choose MAXScript Listener.

To remove the Listener from the viewport:

1. Right-click the menu bar on top of the viewport.

2. Choose any Viewport View mode like Front, Top, Perspective etc.

Listener Color And Font Customization

The following MAXScript System Globals can be used to customize the colors and fonts used by the MAXScript Listener.

editorFont editorFontSize inputTextColor messageTextColor outputTextColor listenerBackgroundColor macroRecorderBackgroundColor macroRecorderTextColor pythonPromptColor 

See the examples in the MAXScript System Globals topic.

The Mini-Listener

A resizable Mini Listener is located on the left side of the 3ds Max status panel.

If the Mini Listener is not visible, drag on the vertical split bar at the left edge of the status panel to reveal the Mini Listener.

The Mini Listener panes act as single-line sliding windows for the current line in the corresponding Listener panes.

The Mini Listener panes always show what you are typing or where the edit cursor is placed in the Listener panes.

Conversely, anything you type into a Mini Listener pane is entered into the corresponding Listener pane at the current edit cursor position.

You can right-click the Mini-Listener window to access a context menu which provides you with the option to open the MAXScript Listener window and the Editor window.

In addition, if there are existing commands already present in the respective pane of the Listener, the menu will also contain a list of these commands. You can select a command from the menu to reevaluate it in the Listener. The command will be evaluated immediately.

The color and font customizations applied to the MAXScript Listener also affect the Mini Listener.

See the topic MAXScript System Globals for examples.