All the major definition constructs in MAXScript (such as, utility, rollout, macroScript, rcmenu, tool, plug-in, and others) can now include global variable declarations at the top-level within them.
EXAMPLE |
rollout foo "foo" ( local a, b = undefined, c global d, f = 3 -- now possible spinner bar "Bar" checkBox baz "Baz: " on bar changed do print a --etc ) |
In releases prior to 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.