Illegal self-reference in controller script
Good afternoon, fans of MAXSCRIPT.
There is some function that calculates the rotation of the object number One, depending on the distance between objects One and Two.
I'm trying to write this function as Rotation_script () for the controller Rotation of the object number One.
Code for writing looks like this
*****************************************************
ctrl = Rotation_script()
$T2_VerticalOs.rotation.controller = ctrl
ctrl.addNode "Cam_Ferst" $Cam_Ferst
ctrl.addNode "Cam_Second" $Cam_Second
ctrl.addNode"T2_VerticalOs" $T2_VerticalOs
ctrl.addConstant "FerstAngel" (FerstAngel)
ctrl.addConstant "SecondAngel" (SecondAngel)
ctrl.addConstant "iniDist" (iniDist)
ctrl.addConstant "iniAngel" (iniAngel)
txt = "FFF = 0.0 as float \n"
txt += "if FerstAngel > SecondAngel then ( \n"
txt += "FFF = FerstAngel - iniAngel * (1 - distance Cam_Ferst.pos Cam_Second.pos/iniDist) \n"
txt += ") \n"
txt += "else ( \n"
txt += "FFF = FerstAngel + iniAngel * (1 - distance Cam_Ferst.pos Cam_Second.pos/iniDist) \n"
txt += ") \n"
txt += "quat FFF [0,1,0]"
ctrl.setExpression txt
*****************************************************
after running the script, the message
\\\\Illegal self-reference in controller script////
I can't find the bug ? Although all nodes and constants in the Script Controller window is displayed correctly. Is there a GURU who can help?