How do I change the text in a Text Shape dynamically?

MAXScript Frequently Asked Questions

Normally, the text of a Text shape is not animatable. The resulting mesh will be evaluated once at the beginning of the rendering and will not change as it is considered static (not changing over time). A workaround is to assign a script controller to a property of the text shape which will do two things: tell the renderer that the text shape is animated and thus requires reevaluation on each frame, and set the actual text in the text property.

WARNING:

Changing the text object's text property in anything other than a controller applied to the text object can lead to a renderer crash!

Example:

b=box name:"ControlBox" wirecolor:blue

t=text name:"ControlledText" wirecolor:red

t.baseobject.renderable=true

t.kerning.controller=float_script()

scrpt="dependsOn

$'"+b.name+"';$'"+t.name+"'.text=$'"+b.name+"'.height

as string\n0"

t.kerning.controller.script=scrpt

animate on at time 100 b.height*=2

max tool zoomextents all

playAnimation()

 

See also

Frequently Asked Questions