Illegal self-reference in controller script

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?

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Any's picture

Illegal self-reference in controller script

there was one more message

---------------------------
Maximum Nested Error Dialog Depth Reached
---------------------------
Attempt to display more that maximum number of simultaneous error message dialogs occurred.
See error log file for additional error messages
---------------------------
ОК
---------------------------
where is this file and how to see it?

Any's picture

Illegal self-reference in controller script

rewrote the code the controller script for this

***************************************************
if (FerstAngel > SecondAngel) then (
angleaxis (FerstAngel - iniAngel * (1 - (distance $Cam_Ferst.pos $Cam_Second.pos)/iniDist)) as float [0,1,0]
)
else (
angleaxis (FerstAngel + iniAngel * (1 - (distance $Cam_Ferst.pos $Cam_Second.pos)/iniDist)) as float [0,1,0]
)
***************************************************
and the system issued the message

\\\\ Unable to convert: 18.1212 to type: AngleAxis /////

The calculation is correct....

What to do in this situation???

jahman's picture

.

check out this thread

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.