VASSAL Reference Manual

Home > Module > Game Piece Palette > Game Piece > Properties

Properties

A Property is like a variable in programming: it has a value which can be referenced by including its name in Expressions, Message Formats and other similar fields. Most types of Property have their values change through the course of the game. Some Properties can have their values set by commands provided in Game Pieces themselves; others have their values set by the system and cannot be changed from within the module.

Each Game Piece has its own set of properties (each with a name and a value) that can be used for identification by various components. You can add your own new properties to a Game Piece explicitly by adding Dynamic Property traits to create values which can be changed during the course of the game and Marker traits for properties whose values will remain constant. System-defined properties are also added implicitly when other traits are added (see below). Global Properties can also be defined for a Zone, a Map or for the entire module. If a referenced Property name is not defined in a Game Piece, the VASSAL looks for the value in the Zone containing the piece, then in the Map containing the piece, then in the module.

Properties can be matched using Expressions like name == value for an exact match, name != value for a non-match, or name =~ value for a regular expression match. For properties that return a numeric value (e.g. the level in a Layer) you can use <, <=, >, and >=.  You can combine expressions using && for logical AND and || for a logical OR.

Components that use properties
  • Any Message Format defined in a Game Piece will substitute values for the properties defined on that Game Piece.
  • The Global Key Command component uses properties to determine which pieces will respond to the command.
  • The Game Piece Layers component uses properties to determine relative ordering when drawing pieces on the map.
  • The Trigger Action trait uses properties to determine when to fire a Key Command or Named Key Command .
  • The Text Label trait substitutes properties when setting the text of the label.
  • A Zone uses properties to specify a Zone Highlighter.
Properties defined by Game Pieces
  • The Basic Piece defines properties related to a piece's name, location, side, and whether it's selected.
  • The Layer trait defines properties related to the state of that Layer.
  • The Rotate trait defines properties related to the current facing of the piece.
  • The Text Label trait returns the value of the label as a property.
  • The Marker trait allows you to define your own static properties.
  • The Dynamic Property trait allows you to define your own changeable properties.
  • The Mark When Moved trait sets a property when a piece has moved.
  • The Mask trait sets a property when the piece is masked.
  • The Invisible trait sets a property when the piece is invisible.
  • The Property Sheet trait exposes a set of user-editable properties.
Properties defined by other components
  • The Global Property component defines properties for a Zone, Map or the module.
  • The Global Options component allows you to tie property values to preferences settings.
  • The results of a roll by a Dice Button is exposed as a property
  • A Deck component exposes the number of cards remaining as a Map-level property.

Handy Combined List of VASSAL-defined Properties for Game Pieces

Property Trait Description
BasicName Basic Piece The basic name of the piece.
ClickedXBasic PieceMap X-coordinate where player last right-clicked on piece to bring up context menu (or 0 if never).
ClickedYBasic PieceMap Y-coordinate where player last right-clicked on piece to bring up context menu (or 0 if never).
CurrentBoard Basic Piece Current Board name or "" if not on a map.
CurrentMapBasic PieceCurrent Map name or "" if not on a map.
CurrentXBasic PieceCurrent X-coordinate of the piece.
CurrentYBasic PieceCurrent Y-coordinate of the piece.
CurrentZoneBasic PieceCurrent Zone name if the current map has a multi-zoned grid, or "" if the piece is not in any zone, or not on a map.
DeckNameBasic PieceCurrent Deck name if stacked in a Deck, or "" if not in a Deck.
IgnoreGridDoes not stack"true" if this piece ignores the map grid when moving.
ImmobileDoes not stack"true" if this piece cannot be moved by drag and drop.
InvisibleInvisible"true" if this piece is invisible to the current player.
InvisibleToOthersInvisible"true" if this piece is invisible to other players.
LocationName Basic PieceName of the piece's current location, as determined by the map's Zone (if any) and grid settings.
MovedMark When Moved"true" if this piece has moved since the last time its movement history was cleared.
NoStackDoes not stack"true" if this piece cannot stack with other pieces.
ObscuredMask"true" if this piece is masked from the current player.
ObscuredToOthers Mask"true" if this piece is masked from other players.
OldBoardBasic PieceBoard name prior to most recent movement.
OldLocationName Basic PieceLocation name prior to most recent movement.
OldMapBasic PieceMap name prior to most recent movement.
OldXBasic Piece X coordinate prior to most recent movement.
OldYBasic Piece Y coordinate prior to most recent movement.
OldZoneBasic PieceZone name prior to most recent movement.
PieceNameBasic PieceFull piece name including both Basic Name and all additional strings provided by traits.
playerSideBasic PieceSide of the current player (not the side of the piece).
RestrictedRestricted Access"true" if there are restrictions as to who can access this piece.
SelectedBasic Piece"true" if the piece is currently selected.
<property_name>PropertySheetThe value of each property on the Property Sheet can be accessed via the property name.
<layername>_ActiveLayer"true" if the Layer <layername> is currently active.
<layername>_ImageLayerThe image name of the currently active layer for Layer <layername>.
<layername>_LevelLayerThe level number of the currently active layer for Layer <layername>.
<layername>_NameLayerThe level name of the currently active layer for Layer <layername>.
<rotatename>_FacingCan RotateThe current facing number (1, 2, etc) for the Can Rotate trait <rotatename>.
<rotatename>_DegreesCan RotateThe current degrees of rotation for the Can Rotate trait <name>.
<Property Name>Text LabelIf the "Property Name" field in the trait is filled out, then a property with that name will be filled with the current value of the Text Label trait's Text field.
<deckname>_numPiecesDeck (Map level property)Number of pieces/"cards" in the Deck <deckname>.
<deckname>_<expression_name>Deck (Map level property)The number of pieces/"cards" for which the named expression evaluates to true in the Deck <deckname>.