Loading and Running Your Script File

You can open a script file for editing, or you can include it in another script to run automatically when that script runs.

To run the script you just saved:

  1. Reset 3ds Max.

  2. Go to the Utilities panel, turn on MAXScript, and in the MAXScript rollout, click the Run Script button.

The Choose Editor File dialog appears.

  1. Select the box_draw.ms file, and click Open.

MAXScript immediately carries out the command that is contained in the script file and places a box in the scene.

To open a script file for editing:

If you want to edit your script later to add more commands to it, you need to open it:

  1. In the MAXScript rollout, click the Open Script button

  2. Select the script you want to edit and click Open.

The Script Editor window opens, showing the text of your script. You can now edit your commands or add new ones, as you would edit any other text file. Save the script file to keep your changes.

To evaluate the commands in your script:

If you enter any commands in the Script Editor window manually (not by copying and pasting from the Listener window), you can test the validity of all commands:

  1. If your Listener window isn't open, click the Open Listener button in the MAXScript rollout.

  2. In the Script Editor window, choose File > Evaluate All.

MAXScript evaluates the commands in your script file. It sends any feedback to the Listener window. It also sends each valid command to the user interface as if you had run the script. If your script contains any syntax errors, MAXScript reports those in the Listener window in red.

To include your script in another script:

If you want to write a script for each tutorial (for example one for drawing a box, one for modifying the box, and another one for transforming it), you could then use those three scripts in another one that contains all the box operations. Assuming you had created the scripts box_draw.ms, box_mod.ms, and box_trans.ms, you could then include them in a new script, box_all.ms. The text for box_all.ms would be as follows:

include "box_draw.ms"

include "box_mod.ms"

include "box_trans.ms"

To reset 3ds Max before running scripts:

If you want to start with a new scene before running any scripts, you need to reset the software:

  1. Choose File > Reset.

  2. Answer the Yes-No prompt to either save or discard the changes to your scene.

  3. Open and run the script you want.

Note that resetting the software closes all MAXScript windows so that you can't copy any more commands from the Listener window. You can always copy commands from the help file, as described below.

To copy commands from the help file:

You can copy commands from the tutorial help file:

  1. In the Help window, highlight the command you want to copy.

  2. Right-click the highlighted text and select Copy from the pop-up menu.

  3. In the Script Editor window, choose the Edit > Paste menu to paste the command into the current script file, or press CTRL+V on your keyboard.

Next Topic

Loading Other Scripts