3DS Max ---Runtime error: Illegal self-referencing in controller script. Can this error be solved

3DS Max ---Runtime error: Illegal self-referencing in controller script. Can this error be solved

Roger.Bastow
Participant Participant
2,051 Views
17 Replies
Message 1 of 18

3DS Max ---Runtime error: Illegal self-referencing in controller script. Can this error be solved

Roger.Bastow
Participant
Participant

Hello, im new and desparate for a solution 🙂 This is my problem:

 

Runtime error: Illegal self-referencing in controller script. Can this error be solved?

I have a rectangle named “B6_Tappet_Dummy_Intake” with a Float script inserted on the Y position.

 

The float scrip has variables: alpha, ctr, F, NT, S, T. The expression is:

 

alpha = abs (mod alpha 360)

ang1 = 60

ang2 = 300

L = 12.3

r1 = 13.5

r2 = 12.3

if alpha < ang1 or alpha > ang2 then (ctr + L * cos(alpha) + r1)

else

(ctr + r2)

 

Alpha is assigned to Target:

$B6_DRIVE_DUMMY_INTAKE.rotation.controller. ‘X Rotation’.

 

Ctr is assigned to Target:

$B6_Cam_Dummy_Intake.pos.controller. ‘Y Position’.

 

 F = frames NT = normalised time S = secs T = ticks If I rotate the object “B6_DRIVE_DUMMY_INTAKE” on the X axis the expression works and moves the object named “B6_Tappet_Dummy_Intake” as per the expression.

 

I can key frame the object “B6_DRIVE_DUMMY_INTAKE” and it still works. I now have a new dummy in the scene that’s wired to rotate on X axis. If I use Wire Parameters to connect this dummy to the object “B6_DRIVE_DUMMY_INTAKE” it works correctly until I close 3DS Max and re-open it. When I do re-open the project, I get an error: --Runtime error: Illegal self-referencing in controller script. Can this error be solved?

 

Ive actually tryed contacting Autodesk direct but they could not solve it?

Kind regards

Roger

 

0 Likes
Accepted solutions (1)
2,052 Views
17 Replies
Replies (17)
Message 2 of 18

denisT.MaxDoctor
Advisor
Advisor

Of course, this problem is solvable... But it will take a long time to explain it in words, and it won't be understandable anyway. I suggest that you just post the file with this error and I will try to fix it and post it back.

 

 

PS. save the file in version 2020 or earlier.

0 Likes
Message 3 of 18

Roger.Bastow
Participant
Participant

Hi Denis, Thanks for replying.
I have been trying to solve this problem for months talking to technical support, Autodesk and Chat GTP. Chat GTP got the closest, would you believe.
The file is huge so I stripped out everything that’s not necessary but its still quite big, 19.9 MB. When I tried to put the error into the cut down model it allowed me to Wire in one, but the next would not work, but no error?

 

What the best way to send the file? 
Kind regards
Roger

0 Likes
Message 4 of 18

denisT.MaxDoctor
Advisor
Advisor

Ha ha ha... I had something like this in mind. That's what happens all the time. You ask for a passport photo and they try to send you a full-length photo on a horse. 😁
I'm just kidding.

 

I'm going to try to write a little script that will delete anything that doesn't relate to the problem in your scene. And then we'll see from there. But will have to wait a couple more days as I have a lot of work to do right now.

0 Likes
Message 5 of 18

Roger.Bastow
Participant
Participant

Hi Denis 😂

If you can solve this your a God! 

Kind regards

Roger

0 Likes
Message 6 of 18

Roger.Bastow
Participant
Participant

Hi Denis

I managed to recreate the error. Do you want me to WeTransfer the file to you?

 

Kind regards

Roger

0 Likes
Message 7 of 18

denisT.MaxDoctor
Advisor
Advisor

there is something that confuses the wire controller with "possible" self-dependency. I don't see any circular dependency there, but can see the error message. so, my suggestion is to replace the wiring with a script controller:

 

paramWire.connect $CAM_DRIVE_DUMMY_B.rotation.controller[#X_Rotation] $B6_Cam_Exhaust.rotation.controller[#Z_Rotation] "-X_Rotation +1.05"

 

 

 

s = $b6_cam_exhaust.rotation.controller[3].controller = float_script()
t = $cam_drive_dummy_b.rotation.controller[1]

s.addtarget "xrot" t 
s.setexpression "degToRad (1.05 - xrot)"

 

 

which has to do the same thing

 
0 Likes
Message 8 of 18

Roger.Bastow
Participant
Participant

Hi Denis

Thank you for the help so far 🙂 The next bit I don't want to get wrong as I'm not very good at scripts. I have attached two images.

1) Can I confirm that the scrip controller goes between the two objects in my image as an example?

2) Do I use a Float Script on X Rotation ?

 

I want to do this a bit at a time. Hope this makes sense.

Kind regards

Roger

 

 

0 Likes
Message 9 of 18

denisT.MaxDoctor
Advisor
Advisor

@denisT.MaxDoctor wrote:

there is something that confuses the wire controller with "possible" self-dependency. I don't see any circular dependency there, but can see the error message. so, my suggestion is to replace the wiring with a script controller:

 

paramWire.connect $CAM_DRIVE_DUMMY_B.rotation.controller[#X_Rotation] $B6_Cam_Exhaust.rotation.controller[#Z_Rotation] "-X_Rotation +1.05"

 

 

 

 

 

s = $b6_cam_exhaust.rotation.controller[3].controller = float_script()
t = $cam_drive_dummy_b.rotation.controller[1]

s.addtarget "xrot" t 
s.setexpression "degToRad (1.05 - xrot)"

 

 

 

 

which has to do the same thing

 

1. select b6_cam_exhaust

2. in motion panel select and right click its rotation->z_rotaion

denisTMaxDoctor_0-1700140293735.png

 

3. assign a float script controller

it opens the script controller dialog

denisTMaxDoctor_1-1700140686411.png

3. Create xrot variable

4. Assign Track:

CAM_DRIVE_DUMMY -> rotation -> x_rotation

5. add expression - degToRad (1.05 - xrot)

6. Evaluate

7. Close

 

that's it

0 Likes
Message 10 of 18

Roger.Bastow
Participant
Participant

OMG! It worked! 

Denis, do you realise who many months I've been trying to solve this problem. At least 6 months!

I am so grateful, thank you so much!

Kind regards

Roger

0 Likes
Message 11 of 18

denisT.MaxDoctor
Advisor
Advisor
Accepted solution

Well... move on to other problems, and don't forget to mark this as a solution.

0 Likes
Message 12 of 18

Roger.Bastow
Participant
Participant

Hi Denis

I did the first ban of cylinder, saved opened and no problems. I then did the next bank of cylinders on the other side. They work perfectley. The only change I made was a direction change (degTorad (120 + xrot) and I Assigned to: (CAM_DRIVE_DUMMY_A). But when I reopen I get:

But when I saved and re opened all the --Runtime error: Illegal self-referencing in controller script 

and the second bank will not work? I wonder if I can just use  (CAM_DRIVE_DUMMY_B) for all ?

0 Likes
Message 13 of 18

denisT.MaxDoctor
Advisor
Advisor

It's all very messy.
To unravel it, you have to understand how things work. That takes time.
These kinds of rigs are never created manually. It's because of the difficulty of debugging.

 

I don't even know where to start yet. I'll have to think about it.

0 Likes
Message 14 of 18

Roger.Bastow
Participant
Participant
Hi Denis
I may have a work around. Wiring to CAM_DRIVE_DUMMY_B worked so I'm going to use that for the other side. For some reason CAM_DRIVE_DUMMY_B is not wired in any more so it does not go round?
0 Likes
Message 15 of 18

Roger.Bastow
Participant
Participant

Linking to the other side seems to have worked. I closed it, and re opened it and one works fine. Just have to do the other 5. Fingers crossed.

Kind regards

Roger

0 Likes
Message 16 of 18

denisT.MaxDoctor
Advisor
Advisor

Usually the system does not allow you to create any dependency, warning you about self-dependency. Of course it is not a direct connection, but possibly through many other connections.
But our problem is more complicated... when we connect everything manually, we do it in a certain order, and everything goes smoothly without errors. Then we save the file, but when we reload the file again, the system itself builds these connections, but in a different order, which leads to a loop.
It is necessary to go through all the chains to understand where these "loops" have formed.

0 Likes
Message 17 of 18

denisT.MaxDoctor
Advisor
Advisor

You have 89 wire controllers and 64 script controllers in the scene...

 

this is the tangle we have to unravel. 

0 Likes
Message 18 of 18

Roger.Bastow
Participant
Participant

Oh, I take it that's not good?

0 Likes