Reserved Words

 

Reserved words are words that have inherent meaning in MEL. These words can specify a variable type, control logic, or represent a value. The following are reserved words in MEL.

break

case

continue

default

do

else

false

float

for

global

if

in

int

matrix

no

off

on

proc

return

string

switch

true

vector

while

yes

 

Data type keywords

 

int

float

vector

string

matrix

       

 

Boolean constant keywords

yes

no

on

off

true

false

 

The only constants in MEL are Boolean constants. Boolean constants are actually int types that are either 1or 0 in value. The keywords true, on, and yes have a value of 1. The keywords false, off, and no have a value of 0. 

 

In MAXScript, the Predefined Globals (constants) True, False, On and Off are NOT Integer types with values of 1 and 0, but have actual BooleanClass values of True and False.

This means that other than in MEL, logical expressions return actual BooleanClass values as results, and integers cannot be used directly in place of logical expressions.

For example, you cannot say

myInteger = 1

if myInteger then print "It is True" else print "It is False"

because MAXScript expects a BooleanClass after the if statement and will throw the error

-- Type error: if-test requires BooleanClass, got: 1

The correct syntax would be

myInteger = 1

if myInteger == 1 then print "It is True" else print "It is False"

 

 

 

Flow control keywords

if

else

for

while

do

in

break

continue

default

switch

case

 

 

 

Other keywords

global

return

source

catch

alias

proc

 

Like variable names, reserved words are case sensitive. So, while int is an int type, Int is not.

 

 

Here is the list of MAXScript reserved keywords:

 

about

and

animate

as

at

by

case

catch

collect

continue

coordsys

do

else

exit

fn

for

from

function

global

if

in

local

macroscript

mapped

max

not

of

off

on

or

parameters

persistent

plugin

rcmenu

return

rollout

set

struct

then

throw

to

tool

try

undo

utility

when

where

while

with

 

 

 

MAXScript Predefined Globals (equivalent to Constants in MEL)

 

true

false

on

off

 

pi

e

 

 

 

red

green

blue

white

 

black

orange

yellow

brown

gray

x_axis

y_axis

z_axis

 

 

ok

 

undefined

 

unsupplied

 

dontcollect

 

 

 

There is also a long list of 3ds max System Globals and MAXScript System Globals. Check them out in the MAXScript Reference.

They provide access to different system parameters that were originally exposed to MAXScript in 3ds max Release 2. (Since 3ds max 4, system access is usually provided using Function Publishing Interfaces).

Other than with reserved keywords, you can assign values to global variables.

 

As everything else in MAXScript, reserved keywords are Case-Insensitive, this means that global, Global and GlObAl mean the same thing. (Contrary to what you might think, this is not the reason for the love of WaReZ JuNkIeZ for 3ds max)