script controller, entering a longer script

script controller, entering a longer script

Anonymous
Not applicable
457 Views
2 Replies
Message 1 of 3

script controller, entering a longer script

Anonymous
Not applicable
hi when I input a multiple line script into a script controller it only adds the last line. Ive tried many ways to make it return using the ¬ key with no success.
How do I get a multi line script to be accepted ?
thanks joe g

cryshape.rotation.controller.Available.controller = rotation_script ()
cryshape.rotation.controller.rotation_script.controller.script = (
"theZ = normalize (" + num1 as string + "-" + objcen as string + ")"
"theUp = "
"theX = normalize (cross theUp theZ)"
"theY = normalize (cross theZ theX)"
"theTM = matrix3 theX theY theZ"+ num1 as string
"$"+cryshape.name as string + ".transform = theTM"
)
0 Likes
458 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Just build a string variable and assign to the controller's .script property. Each line in the string should end with a New Line character \n

cryshape.rotation.controller.Available.controller = rotation_script ()
txt = "theZ = normalize (" + num1 as string + "-" + objcen as string + ")\n"
txt += "theUp = \n"
txt += "theX = normalize (cross theUp theZ) \n"
txt += "theY = normalize (cross theZ theX)\n"
txt += "theTM = matrix3 theX theY theZ"+ num1 as string + "\n"
txt += "$"+cryshape.name as string + ".transform = theTM\n"
cryshape.rotation.controller.rotation_script.controller.script = txt



It is a good idea to avoid using $ names in a script controller though (unless you are running an ancient version of Max).
0 Likes
Message 3 of 3

Anonymous
Not applicable
thanks a lot Bobo
0 Likes