Types of Scripts


All scripts are not created equal, and Max categorizes different scripts based on how they work. For more information, the MAXScript online help provides exhaustive information on their various options.

The main thing to consider when deciding what type of script to create is the user interface. Ask yourself what the most logical user interface would be for the type of tool you're creating, and this gives you a hint as to which type of script is well suited for the task.

Macro scripts

Macro scripts are scripts created with the Macro Recorder. Any script associated with a toolbar button is considered a Macro script. Max organizes Macro scripts by their category, which you can change by editing the script file. To call a Macro script from another script, you can use the macros command. For example,

      macros.run "objects" "sphere" 

runs the "sphere" script in the "objects" category.

Macro scripts generally require no other user input; you just click a button, and the script works its magic.

Scripted utilities

A scripted utility is a MAXScript that has its own custom rollout in the Utilities panel, like the SphereArray example. This type of script is particularly useful when your script has parameters that the user needs to enter, such as the radius in the SphereArray script. Scripted utilities are easy to build using the Visual MAXScript Editor.

Scripted right-click menus

When you right-click an object in your scene, Max opens a pop-up menu of options for you to choose from, much like a quadmenu. Scripted right-click menus let you append your own menu items to the right-click menu. If you create a script that modifies some property of an object, making the script available through the right-click menu makes it easily accessible.

Scripted mouse tools

You can use scripted mouse tools to create scripts that handle mouse input in the viewports. These scripts listen for commands from the mouse, such as clicking the mouse buttons and clicking and dragging the cursor. For example, you would use this type of MAXScript if you were making a new primitive object type so that users could create the new objects just like they would a sphere or a box.

Scripted plug-ins

Scripted plug-ins are by far the most complex type of MAXScript available. They mirror the functionality of non-MAXScript plug-ins (which are written in other programming languages such as C++). You can create scripted plug-ins that make new geometry, create new shapes, control lights, act as modifiers, control texture maps and materials, and even produce special rendering effects.




3ds Max 9 Bible
3ds Max 9 Bible
ISBN: 0470100893
EAN: 2147483647
Year: 2007
Pages: 383

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net