Definition Constructs Can Include Global Variable Declarations At Top Level

All the major definition constructs in MAXScript (such as utility, rollout, macroScript, rcmenu, tool, plug-in, etc.) can now include global variable declarations at the top-level within them.

Example:

rollout foo "foo"

(

local a, b = undefined, c

global d, e = 3 -- now possible

spinner bar "Bar"

checkBox baz "Baz: "

on bar changed do ...

)

In releases prior 3ds Max 4, globals had to be declared inside on-handler bodies. Any initializers present in a global declaration like this are at compile time, so the initial value expressions must be executable at the time the script is compiled.

See also

Scope of Variables