# VASSAL Reference Manual Home > Module > Game Piece Palette > Game Piece > Trigger Action
## Trigger Action Trait
Trigger Action is a multi-purpose trait that alters the behavior of a piece, but not its look. You can use it to combine multiple keyboard commands into one, to automatically fire keyboard commands in response to other keyboard commands when certain conditions apply, or to fire off multiple keyboard commands at a time. Description: Short name for identification purposes. Trigger when properties match: The Trigger Action will only generate new Key commands if the piece matches this Property Expression(after the triggering keyboard commands have finished) Menu Command: Adds an item to the piece's right-click menu that will fire the triggered commands (provided the property expression is matched). Keyboard Command: The keyboard command corresponding to the menu item. Watch for these Keystrokes: After the user types any of these key commands, fire the triggered commands if the property expression is matched. Perform these Keystrokes: The key commands to invoke after one of the above key commands is observed and the property expression is matched. Repeat this set of KeyStrokes (Loop)? Allows you to generate the specified KeyStrokes multiple times. Repeat fixed number of times This loop option allows you to repeat the set of key strokes a specified number times. Repeat while condition is true This loop option allows you to repeat the set of key strokes while a Property Expression remains true. Repeat until condition is true This loop option allows you to repeat the set of key strokes until a Property Expression becomes true. Loop how many times? An Expression that defines how many times to generate the set of KeyStrokes (for a fixed loop). Loop while/until condition is true: Enter the Property Expression that controls how long to keep looping (for a while or until loop). Perform this KeyStroke once before looping starts: For all loop types, enter a KeyStroke that will be performed once before the looping process commences. Perform this KeyStroke once after looping complete: For all loop types, enter a KeyStroke that will be performed once after the looping process finishes. Create a Loop Index Property? For all loop types, allows you to create a Property whose value will changes as the looping process proceeds. Index Property Name: The name of the property that will be created. Index Property start value: An Expression that sets the value of the index property prior to looping commencing. The expression must evaluate to a whole number. Index Property increment value: An Expression that defines how much will be added to the Index Property at the start of each loop. The expression must evaluate to a whole number. Example: A piece has a Layer to track action points and a Move Fixed Distance trait to move it forward. The Move Fixed Distance trait can be assigned the key command CTRL-SHIFT-M with no command name (so that it does not appear in the right-click menu). Then a Trigger Action trait with the command Move and the keystroke CTRL-M can trigger both the Move command and decrease the action points layer by one. Example: A piece has separate Layer traits for hit points and for a "critically wounded" status for when the hit points are less than 2. A Trigger Action trait can watch for the keystrokes that affect the hit-point layer and respond by activating the wounded layer by matching the property expression for when the hit points are < 2 and the wound level is not active. |