You can't add nodes to a float script itself, but instead to the controller track of an object with the float script applied.
I modified your code:
- Code: Select All Code
ca = attributes new
parameters main rollout:params
custLink type:#node ui:pbt_cl
rollout params "Pickbutton Test"
pickbutton pbt_cl "Custom Connect"
on pbt_cl picked obj do
(targ = obj)
rollout test "pbt test"
button btn "Make Box"
on btn pressed do
b = box()
custAttributes.add b ca
holder = point()
holder.parent = b
holder.position.x_position.controller = float_script()
fs = holder.position.x_position.controller
fs.addNode "this" b
fs.addNode "picked" targ
fs.script = "try(with animate off (picked.pos.y = this.parent.pos.y))catch(0)"
createDialog test 200 50
This doesn't result in the errors, however there are problems with your code.
1) You'll notice I added a try()catch() event in the script. This basically tries the initial code, and if there is an error in it, instead of reporting it, the code defined in "catch()" is called instead (basically it's a simple debugging switch). The reason for this is because until you call up your custom attribute, there is no "picked" object....so trying to find its y pos before it exists causes an error.
2) Clicking the button in your custom attribute doesn't actually modify the float script (and the node listed in the float script). Float script variables are stored locally to the script. So modifying the "targ" variable elsewhere in your code (ie...outside of the float script)...will have no effect on the float script. Instead of just assigning a node to the "targ" variable, you'll instead want to call the "setNode" function on the script controller, and re-apply the new target each time the custom attribute button is clicked