Properties

From VASSAL
Jump to: navigation, search

VASSAL Reference Manual

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


Properties

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.  

Properties  can be defined for a Zone, a Map or for the entire module.  If a property is not defined in a Game Piece, the program looks for the value 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 keyboard 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 list of system properties defined for pieces

BasicName: Name of the piece recorded in the BasicPiece trait.
CurrentBoard: Current Board name or "" if not on a map.
CurrentMap: Current Map name or "" if not on a map.
CurrentX: Current X Map co-ordinate of the piece.
CurrentY: Current Y Map co-ordinate of the piece.
CurrentZone: If the current map has a multi-zoned grid, then return the name of the Zone the piece is in, or "" if the piece is not in any zone, or not on a map.
DeckName: Current Deck name, or "" if not in a Deck.
IgnoreGrid: "true" if this piece ignores the map grid.
Immobile: "true" if this piece is an immobile piece (Does Not Stack trait).
Invisible: "true" if this piece is Invisible to the current player.
InvisibleToOthers: "true" if this piece is Invisible to other players.
LocationName: Current Location Name of piece as displayed in Chat Window.
Moved: "true" if the piece has moved. (Mark When Moved trait)
NoStack: "true" if this piece does not stack with other pieces.
Obscured: "true" if this piece is masked to the current player. (Mask trait)
ObscuredToOthers: "true" if this piece is masked to other players. (Mask Trait)
OldBoard: Board name prior to last movement.
OldLocationName: Location name of the piece prior to last movement.
OldMap: Map name prior to last movement.
OldX: Map X co-ordinate prior to last movement.
OldY: Map Y co-ordinate prior to last movement.
OldZone: Zone name prior to last movement.
PieceName: Full name of the piece as reported in the Chat Window.
playerSide: Side of the current player (not side of the piece).
Restricted: "true" if there are restrictions as to who can access this piece.
Selected: "true" if the piece is currently Selected.

Different counter traits will also return properties:

PropertySheet:

<property_name>: The value of each property on the Property Sheet can be accessed via the property name.

Layer:

<name>_Active: "true" if the Layer <name> is currently active.
<name>_Image: The Image Name of the currently active layer for Layer <name>.
<name>_Level: The level number of the currently active layer for Layer <name>.
<name>_Name: The Level Name of the currently active layer for Layer <name>.

Can Rotate:

<name>_Facing: The Current Facing number (1, 2, etc.) for the Can Rotate trait <name>.
<name>_Degrees: The Current Degrees of rotation for the Can Rotate trait <name>.

Decks also have map-level properties that you can reference:

<name>_numPieces: The number of pieces in the deck <name>.
<name>_<expression_name>: The number of pieces for which the named expression evaluates to true in the deck <name>.


'