Vizard 7 » Command Index » Vizard modules » vizact » <vizact>.choice
7.6

<vizact>.choice

Create a dynamic parameter that will be chosen from a list

<vizact>.choice(  
choices  
mode = vizact.LOOP  
)  
choices
A list of possible inputs to the command
mode = vizact.LOOP
The method of selecting a value from the list of choices. Can be one of the following values:

Choice modes

vizact.PLAY

Choose sequentially from the beginning of the list to the end. Once the last choice is reached, it will stay at the last choice

vizact.LOOP

Choose sequentially from the beginning of the list to the end. Once the last choice is reached, it will jump back to the beginning and repeat

vizact.SWING

Choose sequentially from the beginning of the list to the end. Once the last choice is reached, it will iterate through the list backwards

vizact.RANDOM

Randomly select a value from the list

Remarks

Dynamic parameters allow you to control the input of an action every time it is performed. A choice parameter allows the user to specify a list of choices and a flag specifying how to choose from the list.

Return Value

A dynamic parameter that can be passed to any function that generates actions.

Example

#Loop through the following colors
BlackWhite = vizact.choice([viz.BLACK,viz.WHITE,viz.WHITE,viz.BLACK],vizact.LOOP)

#Fade from one color to another using the above dynamic paramter
FadeColor = vizact.fadeTo(BlackWhite,begin=BlackWhite,time=0.5)

#Repeat the fade forever
FadeForever = vizact.sequence(FadeColor,viz.FOREVER)

#The following object will fade between black and white forever
object.add(FadeForever)

See also

<vizact>.randint
<vizact>.randfloat
<vizact>.fadeTo
<vizact>.sequence