Script error - RolloutClass

Hello

I'm working on a script nowdays, but I have got some problem with the Rollouts...
I made a very simple script to show you what is my problem. My goal was to create a button, wich can create a new rollout. The most interesting, that the error message is only in the first run of script, when I run this script second time, it's work.
The script:

rollout MENU "MENU"
(
	button On01 "On" width:90 pos:[10,10]
	button Off01 "Off" width:90 pos:[10,40]
 
	on On01 pressed do
		addRollout Rollout01 menu_windo
 
	on Off01 pressed do
		removeRollout Rollout01 menu_windo
)
 
rollout Rollout01 "Rollout"
(
	button Button01 "Button" width:90 pos:[10,10]
)
 
 
menu_windo = newRolloutFloater "Rollout" 150 180
 
addRollout MENU menu_windo
addRollout Rollout01 menu_windo

And I got this error message when I run this script first time:
"Type error: CreateDialog requires RolloutClass, got: undefined"

It's a picture about the happenings: https://dl.dropbox.com/u/1152958/script_error.jpg

Thanks your helps in advance.

Matyrix

Comments

Comment viewing options

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

menu_windo =

menu_windo = newRolloutFloater "Rollout" 150 180
rollout MENU "MENU"
(
button On01 "On" width:90 pos:[10,10]
button Off01 "Off" width:90 pos:[10,40]
 
on On01 pressed do
addRollout Rollout01 menu_windo
!REG3XP1!>
on Off01 pressed do
removeRollout Rollout01 menu_windo
)
 
rollout Rollout01 "Rollout"
(
button Button01 "Button" width:90 pos:[10,10]
)
 
addRollout MENU menu_windo
addRollout Rollout01 menu_windo

just testing

holycause's picture

thanks Christopher. I used

thanks Christopher.

I used the

 tags, but beacause of the spaces, i got some wierd stuff for a maxscript code. lol
</p>
<p>
&nbsp;
</p>
<p>
I ll use the &lt;code&gt; tags. :D
</p>

Admin's picture

Ahh. I see. I bet you

Ahh. I see. I bet you activated the rich text editor right? It adds in all kinds of html formatting that breaks the code snippet.

I find the best way to work most of the time is to just use the simple text box, any links you type will turn to actual links w/o any [url] tags or anything like that and any code pasted in [ code ] blocks will highlight correctly.

On occasion if I really need formatting I'll use rich text...

Christopher Grant
Admin, ScriptSpot.com

holycause's picture

like this it's working

like this it's working perfectly: Wink

 

 

menu_windo = newRolloutFloater "Rollout" 150 180
 
rollout Rollout01 "Rollout"
(
button Button01 "Button" width:90 pos:[10,10]
)
 
rollout MENU "MENU"
(
button On01 "On" width:90 pos:[10,10]
button Off01 "Off" width:90 pos:[10,40]
 
on MENU open do
(
 
)
on On01 pressed do addRollout Rollout01 menu_windo
!REG3XP1!>
on Off01 pressed do removeRollout Rollout01 menu_windo
 
)
    addRollout MENU menu_windo
    addRollout Rollout01 menu_windo 
Admin's picture

Edited your post to add code

Edited your post to add code tags for syntax highlighting...

http://www.scriptspot.com/forums/scriptspot-how-to/how-to-post-code-snip...

Christopher Grant
Admin, ScriptSpot.com

Matyrix's picture

Thank you very much, it

Thank you very much, it works :)

holycause's picture

it's normal. Don't forget

it's normal.

Don't forget that maxscript is reading line by line, like you do when you read a book.

In your script you ask it to add or remove rollouts, from the rolloutFloater.

 

But at this time, it doesn t know therolloutFloater, because you create it later in the script.

to prevent this, you should create the rolloutFloater before the rollouts. like this

menu_windo = newRolloutFloater "Rollout" 150 180
rollout MENU "MENU"
(
button On01 "On" width:90 pos:[10,10]
button Off01 "Off" width:90 pos:[10,40]

on On01 pressed do
addRollout Rollout01 menu_windo

on Off01 pressed do
removeRollout Rollout01 menu_windo
)

rollout Rollout01 "Rollout"
(
button Button01 "Button" width:90 pos:[10,10]
)

addRollout MENU menu_windo
addRollout Rollout01 menu_windo

Matyrix's picture

Thanks your

Thanks your comment!

Unfortunately your corrected script is not work... I tried to run it on three different computers, but the first time always send error messages... Of course the second run is always works, but it's not a good solution...

What's the wrong?... I don't understand...

Comment viewing options

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