MAXScript Language Reference > 3ds Max Objects > Animation Controllers > Controller Types > Script Controllers >

# Script Controller Assignment Behavior Changes in 3ds Max 8

| Animation Controllers - Quick Navigation

In versions prior to 3ds Max 8, it was possible to provide a script string as a construction parameter, but it did not work as expected.

When assigning a script controller to a track, 3ds Max 7 and earlier automatically reads the current value of the track and assigns it to the new controller to make it valid and to preserve the original value. For example, if the track contains the value 12.6, after assigning the script controller, the string inside the controller will be automatically set to "12.6" to preserve the last known value. For that reason, trying to assign the script in a single pass did not work in 3ds Max 7 and earlier:

EXAMPLE:
    $Box01.height.controller = float_script script:"random 0 100"

The above would not work because the script controller instance is first created on the right-hand side, the script string "random 0 100" is assigned to it, then the controller is assigned to the left-hand side, and its script string is immediately overwritten with a new string containing the current value of the left-hand side track.

You always had to assign the controller first, then assign to its .script property.

EXAMPLE:
    fs =float_script ()
    $Box01.height.controller =fs
    fs.script="random 0 100"

In 3ds Max 8 and higher, the behavior described above has been corrected. An internal flag has been added to all controllers to denote whether the controller is "new" or "not new", thus using the current track value only when a new controller is being assigned.

Thanks to this new behavior, the script string in controllers where the script property has already been set will not be replaced.

#### See Also

- Script Controllers

- Using Script Controllers