Welcome to the wacky world of MAXScript!
- To get started in MXS, I suggest you goto The
ScriptSpot and download
the 'Wad-O-MAXScriptTutorials!' - it's under "Tutorials\Scripting Tutorials".
Do 'demo.ms' first. FYI, in maxR4, they changed a directory name, so
in the
demo.ms file, replace '\\feature_based\\' with '\\FeaturesScenes\\'.
Also, they
changed the filename to 'Example_StartHere.ms'.
- Check the MXSHelp in R4.x:
"MXS4Help\Contents\Introduction\Learning MAXScript".
- Pick apart existing code!
(plenty available at The
ScriptSpot. Mine are typically highly
commented, so you might search "swami" and look at some of them)
- Definitely, check out Bobo's "Boboland".
- The MXSHelp is full of example scripts.
- Learn to use the Listener and the MacroRecorder!
- Comment your code liberally! This makes it easy for you and others
to
follow... especially if you haven't looked at it in a while!
Note to BASIC users:
Though some syntax may look familiar, I caution you to NOT think in
BASIC
terms. MXS is object-oriented and event driven. Every sentence is made
up
of statements that evaluate to a value. This leads to some very different
constructs...
E.g.
bool=true;angle=60
var=(if bool then cos else sin) angle
-- result: var=0.5
Do not limit yourself to the past, or worse yet, get
misdirected or blinded by the past. MXS is a different beast!
Here are a couple quick MXS Editor tips...
1) Ctrl+RCLick
Navigate script.
2) Ctrl+D
Color-code script.
3) Ctrl+B
Check bracketing.
4) Ctrl+R
Cycle thru the 8 most recent locations.
For some useful functions:
Get the 'Wad-O-Functions!' from The
ScriptSpot,
and get 'jbFunctions' from John
Burnett's site - use IE.
Includes a great index html page.
For some useful extensions:
Get the 'Wad-O-Extensions!' from The
ScriptSpot.
Currently, these are all for R3.x. There are a couple for R4.x, but
I have
not compiled an update.
THE textbook!:
Mastering
MAXScript and the SDK for 3D Studio MAX®
By Alexander Bicalho; Simon Feltman
US $49.99 | Can $74.95 | UK £36.99
ISBN: 0-7821-2794-0 | August 2000 | 1st edition | 496 pages | Softcover
| 1 CD
Book Level: All Levels | Book Type: How-to/Reference
* And when all else fails, post a question to the 'MAXScript' conference
on the MAXForum!
Good luck, and CODE ON!...
AlgorhythmicallYours,
s* [ForumAssistant]
a.k.a. "codeWarrior()"
P.S. - Advanced info regarding loading order of scripts...
"
From: "Larry Minton" <larry.minton@autodesk.com>
Subject: Re: Script for selecting Biped.HELP
Date: Thursday, April 26, 2001 9:42 AM
If you need to have some functions/global variables defined for use
by
the macroscript, those should go into a .ms file in
stdplugs\stdscripts.
Load order, and the reasons why, are:
1. script files in plugin direcotories and their subdirectories -
define functions, methods, and structures used by other scripts,
particularly macroscripts. The MAX scene has not been created and the
viewports have not been created. You cannot create scene objects or
do
anything UI related in these scripts. Of course you can define
functions that do these operations, you just can't call these
functions at this point.
2. .mcr files in ui\macroscripts - define macroscripts that can be
displayed in the UI. UI has not been built yet, the macroscripts will
be needed to fill in their related buttons.
3. startup.ms, scripts\startup - scene, viewports, and UI are up. You
can do anything here you want.
"