MAXScript Debugger >

# Accessing the Debugger Dialog

The MAXScript Debugger Dialog can be opened using

- The 3ds Max Main menu > MAXScript > Debugger Dialog... item

- The MAXScript Listener menu >Debugger>Debugger Dialog...item

## The Debugger Dialog

The MAXScript Debugger Dialog runs in a separate thread and is thus independent of 3ds Max.

The Debugger has its own icon and will be represented as a separate application in the Windows Taskbar. This allows it to break the execution of 3ds Max threads while remaining interactive.

The Debugger Dialog is resizable - you can drag the bottom right corner or the borders of the dialog to resize. You can also minimize, maximize and close the dialog as any other window.

The Debuggerdialogprovides the following controls:

## Command

This is a command line where you can input Debugger commands to navigate the code frames, query variables, change variable values and execute MAXScript commands in Break mode.

Available commands are:

- threads - list all threads

- setThread<integer literal> - set specified thread as active thread stack - dump stack for active thread

- setFrame<integer literal> - set specified frame as active frame locals {<string literal>} - dump variables for current active thread and frame, or specified variable

- getVar<string literal> - get value for specified variable in active frameor global

- setVar<string literal> <expr> - set value for specified variable in activeframe or global, expression is evaluated in active frame's scope

- eval<expr> - evaluate expression, expression is evaluated in activeframe's scope

- ? - display list of debugger commands

## Output

This is the output window where the code trace-back is output, as well as the results of commands input in the Command line.

## Break

This is the button which breaks the execution of the main 3ds Max thread and allows the Debugger to "peek" into the current state of any MAXScript code that was running in that thread. When pressed, the button will be disabled until the Run or Stop buttons have been pressed to continue the execution of the 3ds Max thread. During a break state, the 3ds Max UI will be completely unavailable.

Note

Functions, mouse tools, plugins, and rollouts that are defined in encrypted scripts will NOT have their local variable values dumped during error traceback, or shown in the debugger framesafter a break.This is to prevent low-level access to encrypted commercial code.

## Run

Resumes the execution of the main 3ds Max thread after a break. The button is disabled by default and becomes available after a break has been performed.

NoteIf you hold down the Escape key when you click on the Run button, MAXScript will typically immediately throw an exception. However, if Break on Error is turned on in the Debugger, this exception will cause a break back into the Debugger.

## Evaluate

This button causes the command line to be evaluated.

## Watch...

This checkbutton opens the Watch Manager dialog which can be used to monitor the values of global and local variables of interest. When checked, the Watch Manager will be opened. When unchecked, the Watch Manager will be closed.

## Stop

This button can be used to stop the execution of the code after a break instead of continuing the execution with Run.The Stopbutton resumes 3ds Max execution, but causes an exception to be thrown by the calling script. This exception will not be caught by the Debugger, allowing the running script to terminate.

NoteThe Stop button is enabled only when execution is broken by a script, not when execution is broken by the Break button.

## Clear

This button clears the content of the Output window.

## The Debugger Parameters Dialog

The Config button opens the modal MAXScript Debugger Parameters dialog which can be used to customize the Debugger settings and toggle certain features on and off.

The MAXScript Debugger Parameters dialog provides the following options:

- Allow Break On Throw- When checked, if a throw has been detected, the Debugger will break the code execution. Default is on.

- Break On Error- When checked, if an error has been detected, the Debugger will break the code execution. Default is off.

- Break On Exception- When checked, if an exception has been detected, the Debugger will break the code execution. Default is off.

- Ignore Caught Throws- When checked, if a throw has been caught, the Debugger will ignore that throw and will not break the code execution. When unchecked, caught throws will still cause the Debugger to break. Default is on.

- Ignore Caught Errors- When checked, if an error has been caught, the Debugger will ignore that error and will not break the code execution. When unchecked, caught errors will still cause the Debugger to break. Default is on.

- Ignore Caught Exceptions-When checked, ifan exception has been caught, theDebugger willignore that exception and will not break the code execution. When unchecked, caught exceptions will still cause the Debugger to break. Default is on.

- Default Throw debugBreak:on- this checkbox controls the default behavior of the Throw() method in MAXScript code. When checked, the optional debugBreak: argument will be assumed true, causing a break in the Debugger from any Throw() method call in your code that does not supply the optional argument. Default is off.

- Enabled In Quiet Mode- when checked, the Debugger will be enabled in Quiet Mode. Default is off.

- Enabled in Net Render- when checked, the Debugger will be enabled during net rendering. Default is off.

- Allow Unsafe Method Calls- normally, the Debugger will only allow "safe" methods to be executed from the Command line and will ignore attempts to execute calls that could potentiallyhangthe main 3ds Max thread.When this checkbox is on, the Debugger will allow such calls. Default is off. In many cases, if a hang occurs, the hang will last only as long as the Command Timeout period. In some cases though, the hang will be complete and the 3ds Max session will need to be manually terminated.

- Show Global Constants- when checked, global constants like pi, e etc. will also be shown. Default is off.

- Show First Frame Only- when checked, only the information of the first frame will be shown. This is useful when you are only interested in the first frame, but there are multiple sub-frames which would be printed to the Output window. Default is off.

- Stay On Top- when checked, the Debugger dialog will always stay on top. Default is off.

- Command Timeout (secs.)- this value specifies how long the Debugger should wait for a command to be executed. After this number of seconds, the execution of the command will be stopped. This means that if for some reason the command causes 3ds Max to hang, control will be safely returned to the Debugger after a specified period of time. Default is 15 seconds.

- GC Timeout(secs.)- this value specifies how long the Debugger should wait for a garbage collection. After this number of seconds, the execution of the garbage collector will be stopped. Default is 5 seconds.

- Break Timeout (msecs.)- this value specifies how long the Debugger should try to break the 3ds Max thread. Default is 5 milliseconds.

- Break Cycle (msecs.)- this value specifies the time period between break attempts. Default is 1 millisecond.

- Reset - resets allsettings to the factory defaults.

- OK- confirms the changes and saves them for future usage.

- Cancel- discards all changes and returns to the Debugger.

#### See Also

- The MAXScript Debugger

- Interface: MXSDebugger