Global Key Command

# VASSAL Reference Manual Home > Module > Game Piece Palette > Game Piece > Global Key Command
## Global Key Command
This trait adds an action that applies a key command to to other pieces, similar to the Global Key Command component of a Map Window. Description: A description of this trait that appears in the Piece definer list Command name: Name of the right-click menu item Keyboard command: Keyboard shortcut of the menu item that initiates the command Global Key Command: The key command that will be applied to other pieces Matching Properties: The key command will only be applied to pieces that match the specified Property Match Expression. Note that the properties named in the expression are evaluated against the target pieces. If you want to compare a property in the target pieces against the value of a property in this piece, then use $property$. All $...$ property references will be evaluated against this piece before testing against other pieces. (see example below) Within a Deck, apply to: Select how the Global Key Command will be applied to pieces in a Deck. Options are All pieces, No pieces, or Fixed number of pieces. If Fixed number of pieces is selected, a field appears to allow entry of the number of pieces in the deck to affect Restrict Range: If selected, the command will only apply to pieces located within a specified distance of this piece. Range: Only others pieces within this distance, inclusive, of this piece will have the command applied to them. If the pieces are on a board with a Hex Grid or Rectangular Grid, then the distance is in units of the grid. Otherwise, the distance is measured in screen pixels. Fixed Range: If selected, then the range is specified as a fixed number. If unselected, then the range will be given by the value of the named property. Range Property: The name of a Property that contains the range to use when Fixed Range is not selected. Suppress individual reports: If selected, then any auto-reporting of the affected pieces will be disabled. Use the Report Action trait to provide a summary message in their place. EXAMPLE: A leader counter and infantry counters both have Marker traits to specify their nationality and type. A Layer trait represents the rallied state of an infantry counter, uses CTRL A to activate the layer, and uses Rally as the name. A Global Key Command on the leader counter can select and rally all infantry counters within two hexes of the same nationality that are not rallied by specifying Range=2 and matching properties type=Infantry && nation=$nation$ && Rally_Active=false. |