Include property value in piece name

I would like to include the current Strength Point (SP) value in the piece name. The SP value is a Dynamic Property of a unit. I either get the $PropertyName$ in the displayed name or a blank name.

Any modules that do this?

Tim

The trait Layer is the way that I am familiar with to achieve this goal. Some Commands & Colors modules put strength points into piece names in this way.

For example, here is the Layer trait for a 4-block unit in Commands & Colors: Napoleonics:

Vassal automatically adds the Level name to and PieceName or OldPieceName properties (this feature depends on trait ordering, I believe). You will notice the radio buttons that determine whether the name becomes a prefix or a suffix. You can also access layer information through other properties; see “Help” on the Layer trait for more.

hint: You don’t have to display a graphic - you can just use the Layer for the Level name feature.

The graphic above is from a future version of Vassal, currently in test. Current release doesn’t have the “only show layer if property” field but is otherwise the same.

2 Likes

Thanks for the idea. I’m looking at a more direct output of a property’s values.into a piece’s name.

The only other method to alter a piece’s name that I’m aware of is the Text Label trait; it can change the piece name to anything at all; the default setting is to append the value of the label inside of parentheses to the end of the existing name (e.g., if your piece is Unit1 and the text label is Strength=4, the new piece name would be Unit1 (Strength=4). However, you could change the piece name to gobbldegook (or append that to the existing name) with no reference to the actual text of the label if you really wanted (so, you could leave the text display blank and only use the trait to change the piece name).

2 Likes

jrwatts
Many thanks for the tip. I’m still fiddling with the options that TextLabel provides but it seems to suit what I need.
Tim

2 Likes