VASSAL Reference Manual

Home > Module > Game Piece Palette > Game Piece > Set Attachment Property


Set Attachment Property

This trait allows a Game Piece to change the value of a Dynamic Property of a another piece attached via an Attachment trait on this piece.

SetAttachmentProperty

Description:

A brief description of this trait for reference in the editor (not used during play).

Property Name:

An Expression that defines the name of the property to be set. Often, a specific Dynamic Property is simply listed by name, but it is possible to compute the name of the Dynamic Property to be changed based on other properties of this piece, e.g., { "Resources" + GetProperty("Side") }. In this case when the property Side holds the value "Allied" then the Global Property to be set will be ResourcesAllied.

Attachment Name:

Matches the Attachment trait with the designated attachment name. Often a specific attachment name is simply listed by name, but several other possibilities are available:

  • Leaving this field blank matches all Attachment names on all of the Attachment traits on this piece.

  • A specific attachment name can be computed with an expression, e.g., { Color + "Thingy" } might produce, e.g., RedThingy

  • An expression resulting in the value true and in which the name of the target attachment being considered is available as the local property AttachmentName, so for example { AttachmentName.contains("ammo") } would succeed for any attachment name that contained the string ammo.

Attachment Basic Name or Index:

Matches attached pieces with a specific index. Indices start at 1. The index number can simply be designated, or several other formats can be used:

  • Leaving this field blank matches all attached pieces on any matching Attachment trait(s), as does index "0". This does indeed mean that the property values of multiple attached pieces could be altered by a single execution of this trait.

  • A specific index number can be computed with a numerical expression, e.g., 2 or { Which + 2 }

  • A specific BasicName can be computed with a string expression and will match with an attachment that has that BasicName property, e.g., { "Victory Points" }

  • An expression resulting in the value true and in which the index of the target attachment being considered is available as the local property AttachmentIndex and its BasicName property is available as AttachmentBasicName, so for example { AttachmentIndex > 3} or { AttachmentBasicName.contains("Front") }. NOTE: Such expressions can result in multiple attachments having their properties set, if multiple attachments match the criteria.

Is numeric:

If true, then changes to the value of the property by this trait will be restricted to integer values.

Minimum value:

Numeric values will be restricted to no less than this number when changed by this trait.

Maximum value:

Numeric values will be restricted to no more than this number when changed by this trait.

Wrap:

If true, then when incrementing this numeric property, values will wrap around from the maximum to the minimum and vice versa.

Key commands:

Adds any number of commands for this piece, each of which will change the value of the designated property in the specified way.

For each Key Command:

Menu command:

Right-click context menu text for the command, or leave blank to display no context menu item.

Key command:

Keystroke or Named Command which will activate this change.

Type:

Select the way in which this command will change the property:

  • Set value directly: Set the property directly to the value of the Expression entered in the New Value field. The properties AttachmentName and AttachmentIndex are available in this context.

  • Increment numeric value: Increment the value of the property by the value of the Expression entered in the Increment by field. To "decrement" the value, simple increment by a negative number.

  • Prompt user: Pop up a dialog and ask the user for a new value for the property. They will be prompted for a new value using the text prompt entered in the Prompt field.

  • Prompt user to select from list: Similar to Prompt User but displays a list of items to select from in a drop-down menu. The items in the list can be generated dynamically by Expressions. If some items evaluate to a blank string, then those items are only purged from the menu if the Purge Blanks option in Global Options is selected; otherwise the blank options appear.