animate

The [ with ] animate <boolean_expr> context corresponds to setting the Auto Keybutton in the 3ds Max user interface. Placing an expression, operation, or block-expression within an animate on context causes keyframes to be generated whenever an animatable property of a 3ds Max object is changed, regardless of the actual state of the Auto Key button. Likewise, placing an expression within an animate off context prevents keyframes from being generated whenever an animatable property of a 3ds Max object is changed. Expressions that change an animatable property of a 3ds Max object, and are not within an animate context, will generate keyframes only if the Auto Key button is on.

Setting the animate context on or off does not affect the state of the Auto Key button. The state of the Auto Key button can be queried and set using the animButtonState global variable. The user can be prevented from changing the state of the Auto Key button using the animButtonEnabled global variable.

EXAMPLES:

obj=box()
liftHeight=50
tStart=0
tEnd=60
loadheight=obj.pos.z
-- lift object, no key generated
animate off
obj.pos.z=loadheight+liftHeight
-- Create key at time tStart to keep object lifted until that time.
-- If tStart != 0, a key will also automatically be created at frame 0.
-- Then create a key at time tEnd to drop the object
with animate on
(
  at time tStart obj.pos.z=loadheight+liftHeight
  at time tEnd obj.pos.z=loadheight
)

HISTORICAL NOTE FOR NEW USERS:

In 3ds Max prior to versions 5, the Auto Key button was called Animate. Since MAXScript has been first introduced back in 3ds Max 2 when there were no Auto Key and Set Key buttons, the MAXScript terminology remains the same for compatibility reasons, including the name of the animate context and the name of the global variable animButtonEnabled . Changing their names to reflect the new 3ds Max UI would break old scripts and is thus not a good idea.