Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / script controller, entering a longer script
  RSS 2.0 ATOM  

script controller, entering a longer script
Rate this thread
 
25791
 
Permlink of this thread  
avatar
  • Joe Ger
  • Posted: 19 April 2009 08:52 AM
  • Total Posts: 89
  • Joined: 11 February 2008 01:35 PM

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 = [0,0,1]”
“theX = normalize (cross theUp theZ)”
“theY = normalize (cross theZ theX)”
“theTM = matrix3 theX theY theZ"+ num1 as string
“$"+cryshape.name as string + “.transform = theTM”
)



Replies: 0
avatar

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 = [0,0,1]\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).



Borislav “Bobo” Petrov

Replies: 0
avatar
  • Joe Ger
  • Posted: 19 April 2009 10:59 AM

thanks a lot Bobo



Replies: 0