Notifications
Clear all

[Closed] Stuck on simple rollouts

Hi all,

Hmm, kinda frustrated here, I had started learning maxscript stopped and started again, everything was going fine, I had been working on a script, anyway now I’m having a problem and it seems so simple. I’m just trying to add another rollout to my floater. And everytime I do, nothing works. I have checked manual and syntax etc…I can’t figure it out!? I have stripped back the code to just the rollouts, if I take the test rollout out it works…so Im stumped.

Keep getting

-- Type error: addRollout requires RolloutClass, got: undefined

My code


 try (closeRolloutfloater CharacterGen) catch()
 CharacterGen = newrolloutfloater "Character Generator" 700 700
 addrollout Create CharacterGen
 addrollout Test CharacterGen
 
 rollout Create "Create"
 rollout Test "Test"	
 (
 )

Bonus Question, why can’t I do math on array counts e.g array1.count * array2.count??

Help and tips appreciated!

Thanks

4 Replies
1 Reply
 lo1
(@lo1)
Joined: 11 months ago

Posts: 0

MAXScript is not a compiled language. You are trying to add a rollout before you’ve defined it.

Try it this way:


 try (closeRolloutfloater CharacterGen) catch()
 CharacterGen = newrolloutfloater "Character Generator" 700 700
 
 rollout Create "Create"
 (
 )
 rollout Test "Test"	
 (
 )
 addrollout Create CharacterGen
 addrollout Test CharacterGen


You most certainly can, post specific code. I’m betting on either a type issue or a parentheses issue.

Wow thanks! That helps alot!

With the array so for example I have 2 arrays of objects define as

BoxArray = $Box* as array
SphereArray = $Sphere* as array

Label Lb_Text "Answer Goes Here"

Then I want to do maths calc with them such as

BoxArray.Count * SphereArray.Count = Lb_Text.text

I even tried adding the following code


Boxes = BoxArray.Count as Integer
Spheres = SphereArray.Count as Integer

Boxes * Spheres = Lb_Text.text

What am I doing wrong?

Lb_Text.text = (BoxArray.Count * SphereArray.Count) as string

Ahhh…perfect! Thanks!