[solved] properties in labels

all module editor Vassal 3.1.0…

I tried to create a Game Piece Image from a Game Piece Layout which has a Label field. I used $myProperty$ for the text in the Label field in the Game Piece Image. Then when I created a Single Piece in my Game Piece Palette that used this Game Piece Image I added below the Basic Image a Marker trait with the key-value pair myProperty and someText. However when I viewed the piece in the palette and when I dragged the piece onto the map it showed $myProperty$ literally for the text.

(separate entirely from the formatted text question earlier which wound up being a Text Box and will work fine, this is just a plain Label)

Is this something that is not supported within Game Piece Image? If so I can readily create a Prototype with the Label trait instead and I know from prior experience it will work that way, but I was trying to keep my life simple. But does the Game Piece Image work this way and I am just doing it wrong? I do note that I did not actually create a Dynamic Property with that name but in the past I have been able to use Marker traits (with Prototypes and Label traits as above) to more or less define the property without a separate Dynamic Property.

(or, shudder, is this something that should work and there is still some issue with saving and loading within the module editor or something? doubt it, but seen it before)

2009/3/5 IrishBouzouki <messages@forums.vassalengine.org (messages@forums.vassalengine.org)>

The game piece layout simply generates a new image within the editor and saves it to your file. When playing a game, the module knows nothing about how the image was created. I think what you want to do is use a Text Label trait in the properties of a piece or prototype.

That’s not really so bad…

Like I said, the Game Piece Image Definitions only work within the editor. The resulting images are spat out to the module. Those images never change during game play. You should just use a Label trait.

  • Michael.

Post generated using Mail2Forum (mail2forum.com)


Here is an example of what I want to do…

I have a unit with six factors (other classes of units are missing the range and/or armor exponential factors) and I want to display them as text across the bottom of the counter under the unit type symbol using something like this…


…with each combat unit then having a Marker trait with the key-value pairs for the six $$ factors stated above.

I can now, as stated earlier, do this using a text box within the Game Piece Layout definition and define the text for each Game Piece Image to hard code the factors instead of using the $$ property values as shown above.

But I do not want to hard code the factors into the image this way so that approach, which worked as far as helping me figure out what I wanted the thing to look like, is going to have to be changed.

My Game Piece Images are going to have to be categorical… ie “PanzerBattalion” and I am going to have to include only the basic unit/type symbol in the Game Piece Layout and Image. (actually, perhaps not even that because I am considering using NATO symbols for only the allies and using German symbols for the axis, but that is not really germane to the question here)

So I am going to attempt to do what I have done in the past and take that base image and use Prototypes with Labels for some items like unit designations and parent formations (which I did not mention above) and either a single Label or a single Text Box for the factors. I want just one Label or Text Box for them because I want VASSAL and the JVM to work out all the minutiae of how to space and justify the individual characters within the whole factor ‘phrase’ for each different unit if you know what I mean.

I will experiment with this and if I run into trouble will come back and ask, but meantime if you happen to see obviously that this will or will not work I would appreciate a pointer to a not-too-involved way of doing this.


It sounds like it should work.

One tip:

If a unit is missing a factor, make sure to actually define the factor as a blank. If you don’t define that property at all, you might get something strange.

I’m also not sure the tags will actually do anything. If you defined the label trait to centre horizontally, that’s all you need.

  • M.

2009/3/6 IrishBouzouki <messages@forums.vassalengine.org (messages@forums.vassalengine.org)>

Post generated using Mail2Forum (mail2forum.com)

well tried it and do have a problem so far…

I used a Label trait in my Prototype and it handled the property values just fine as expected (done that before so no surprise).

But the HTML tags in a Label just show up as literal characters.

And there does not seem to be any Text Box trait that you can put in a prototype, and if there was I am not sure that it would handle the properties.

Am I just doing something wrong in the Label trait properties?

When this was not working at first I looked at the reference manual page for Label and it had tags around the outside. So I tried…[code]

$steps$$morale$ [/code]...but it still did not work. The properties are still decoded just fine but the superscript tag is not being recognized. HOWEVER... the tag IS being recognized or at least not being rendered as a literal string.

Is the simply not supported for this or am I doing it wrong or something?

never mind THIS time it was the bug where you save the module and do not exit the editor and it does not update the editor’s little viewer/player.

(you do need the tag or you get literal rendering… that version just never got saved from that point on until I quit and re-opened the editor)

yes it all works.