At this point you should be able to create all kinds of advanced actions. However, up until now, all the actions are static, meaning they are the same every time. Dynamic parameters allow you to create actions that are different every time they are performed. Dynamic parameters can be passed as arguments to most vizact actions. The value of these parameters is determined when the action is performed, and you can setup these parameters to change values every time.
For example, let's modify an action so that it waits for a random amount of time:
RandomTime = vizact.randfloat(0.5,3.0)
wait = vizact.waittime(RandomTime)
Now every time the wait action is performed, it will wait a random amount of time between 0.5 and 3.0 seconds. You can also create a dynamic parameter that will choose a value from a pre-specified list. For instance, let's assume we have a list of texture objects called textures. With dynamic parameters, we can easily create an action that will animate these textures onto an object:
#Create a dynamic parameter that will
loop through a list of choices
ChooseTexture = vizact.choice(textures,vizact.LOOP)
#Create an action that will apply the chosen texture to
an object
ApplyTexture = vizact.texture_node(ChooseTexture)
#Create an action to wait half a second
Wait = vizact.waittime(0.5)
#Now create an action sequence that will apply a new texture
every half second
AnimateTextures = vizact.sequence(Wait,ApplyTexture,viz.FOREVER)
Instead of looping through the textures sequentially, you could randomly pick a texture by creating the dynamic parameter the following way:
ChooseTexture = vizact.choice(textures,vizact.RANDOM)
Dynamic parameters:
randfloat, randint
choice-- loop, play, swing, random,
elapsed
retval
Action synchronization and management