Vizard 7 » Reference » Flow control » Actions » Dynamic parameters
7.3

Dynamic Parameters

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)

Advanced

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.method.texture(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

See also

In this section:

Action Basics

Action synchronization and management

Sequences

Node commands as actions

Creating your own actions

Actions command table

Other sections:

Tutorial: Using actions

Task basics

Director basics

Timer basics

Animation path basics

Event Basics

Example scripts:

Actions

Event callbacks