I get an error when the expression is applied because the addNode doesn't seem to have worked. I have other code that's exactly the same (sometimes addNode, other times addObject) and it works fine. Under what circumstances do addNode & addObject not get applied. I've confirmed that the object assigned in addNode does exist. I'm just not sure why it's not being inserted into the float_script.
if widgetType == "joystick" then -- remember, from upper-left, clockwise: 1, 2, 3, 4
widgetNode = getNodeByName(widgetName)
print("widgetNode = " + widgetNode.name)
if (widgetNode != undefined) then
-- each morpher is limited to 100 morph targets, so we'll just zip through all to see
-- if there is any data in the morph. If there is, then we'll check it's name against shapeName
for i=1 to 100 do
morphMod = $neutral
targetName = WM3_MC_GetName morphMod.morpher i
if targetName == shapeName then
expr = "widgetNode.position.controller.x_position.controller.value*100"
fe = float_script()
fe.addNode "widget" widgetNode
morphMod.morpher[i].controller = float_script()
print("EXPRESSION: " + expr)