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. In the 3ds Max Main Menu, click MAXScript and click the Run Script menu item.

    The Choose Editor File dialog appears.

  3. 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 menu, click the Open Script menu item.

  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 menu item in the MAXScript menu.

  2. In the Script Editor window, choose Tools > 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.

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