[Closed] Simple script controller assignment question
Hi, I am trying to write a simple script to set a list controller and a script controller on that, then assign the script of the script controller.
When I write this:
picked = $
picked.position.controller=position_list()
picked.position.controller.available.controller=position_script()
picked.position.controller.position_script.script= “[ 1, 1, 1 ]”
There is an error in the last line. Yet, I can’t figure out what the syntax should be…
Can anyone point me in the right direction?
Thanks!
I feel your pain. I get confused doing the same things sometimes. It’s very frustration, because there is no good debugger for MaxScript.
picked = $
picked.position.controller=position_list()
picked.position.controller.available.controller=position_script()
picked.position.controller[2].script= "[ 1, 1, 1 ]"
Hi, I wanted to avoid using the index number and base it on the name if possible. I guess I’ll use the index number. Thanks for the quick response!
I don’t think you can because there could be more then one position_script in the list. So it wouldn’t know what one you were referring to.
If you are going to reference this script controller in another part of your code. Try setting it as the active controller, and then later just reference the active one.
This is what i do.
Here is how I would have done it – assigns the controller to a variable, then use the variable to assign or change properties instead of typing in ’ picked.position.controller.’ again and again…
picked = $
theListCtrl = position_list()
picked.position.controller= theListCtrl
theScriptCtrl = position_script()
theListCtrl.available.controller= theScriptCtrl
theScriptCtrl.script= "[ 1, 1, 1 ]"