Notifications
Clear all

[Closed] simple animate script not working

 em3

I have a script that used to work


 --(
 --Objs = for o in objects collect o
 for o in selection do
 (
 print o.name 
 myNum = --random 100 200
 my2ndNum = myNum+100 --random myNum 
 myZ = o.pos.z
 print myNumz
 	print o.name
 o.visibility = bezier_float() -- Track View: Add Visibility Track
 addNewKey o.visibility.controller myNum #select
 addNewKey o.visibility.controller my2ndNum #select
 o.visibility.controller.keys[1].value = 0
 o.visibility.controller.keys[2].value = 1 --<BREAKS HERE
 addNewKey o.pos.controller.Z_Position.controller myNum #select
 addNewKey o.pos.controller.Z_Position.controller my2ndNum #select
 o.pos.Z_Position.controller.keys[1].value = myZ +1000
 o.pos.Z_Position.controller.keys[2].value = myZ --<BREAKS HERE
 --actionMan.executeAction 0 "40022"
 )

gets a “– Unknown property: “value” in undefined”

It’s breaking when I add the second controller key. I am using 3ds max 2011 vanilla. Thanks!

4 Replies

What are you trying to do with this script?

I worry that MyNum hasn’t been initialized.
Is the collection zero based? That is, does [2] not exist, only [0] and [1]?

 em3

@gruhn – yep, myNum was commented out. What a tardling I am.

@lucpet – the script will animate the z position of a group of object in the order of their proximity to 0,0,0 so that objects nearest that coordinate animate first, farther away animates last.

1 Reply
(@lucpet)
Joined: 11 months ago

Posts: 0

If you look at the script in my reply you’ll see I pointed that out as well as myNim(z) hasn’t been initialised or typo, look for –MY COMMENTS IN ALL CAPS