Notifications
Clear all

[Closed] "undefined" External Global rollout

I am in script A. Then I call script B where rolloutB is defined as global at the begining.


 ...
 		fileIn (getdir(#userScripts) + "\\B.ms")
 		print rolloutB
 ...

Script B:

(
 global rolloutB
 ...
    rollout rolloutB "Rollout B" width:550 height:430
    (
    )
    createDialog rolloutB 223 200
 )

I need it to use it with setDialogPos to link position of rolloutB with rolloutA. If I run the script more times, then it starts to work. But If I restart 3d max then I get undefined for rolloutB.
Please help me!

4 Replies

One thing you could try is defining the rollout global before the filein() instead of defining it in the rollout script:

(
 	global rolloutB
 	fileIn (getdir(#userScripts) + "\\B.ms")
 	print rolloutB
 )

Script B:

(
 	rollout rolloutB "Rollout B" width:550 height:430
 	(
 	)
 	createDialog rolloutB 223 200
 )

If you want to keep the global declaration in the rollout script, then you could try:

print ::rolloutB

Oh, Jorge, as always you save me a lot of time! Thank you soo much!
It’s working just fine now!

another way is in script A call:

print (globalvars.get #rolloutb)

Thank you Denis. This information is really very important. I will use your code in other script of mine that deals with external global var. Thank you both, once again!