Switching on/off labels

I was trying to come up with a way to turn on/off text labels for game pieces, with the initial state of it being off. Originally, I had set up a Dynamic Property with the “Value” field being blank, and some commands set up to change the value to some text, and then back to blank. It managed to save this way, but the module crashed every time I tried to load it. Turns out that VASSAL didn’t like the Dynamic Property having a null value.

So, next I set up a Marker named “Blank”, and with the value field blank. The Dynamic Property now called $Blank$ in the initial value field and in one of the command value fields. This worked, at least partly. In the game piece palette and when it was initially placed on the board, the game piece showed “$Blank$”. After cycling through the hide and show commands set up by the Dynamic Property, the label showed what it was supposed to by hiding and showing the text, but now the text is off-center, since it’s a different length than “$Blank$”. This can be corrected by cloning the piece, but that’s not the best solution.

My best solution so far has now been to set the Dynamic Property’s initial value field to the text I want, and to set the Map Window’s “Key Command to apply to all units ending movement on this map” set to send the “hide” command. This way, the game piece comes in with the label text hidden, and I can show and hide it on command, and it’s centered properly. My only issue now is that the label now automatically hides every time the piece is moved.

So, after that long explanation, is there any way to send a command only when a piece is placed on a board, and not every time it’s moved on that board? It would seem that VASSAL does know the difference between the two, since the messages in the chat window are different when creating a piece as opposed to moving a piece. Or perhaps, is there another alternative way of doing what I described above that I haven’t though of?

Thanks,
B.J.

Set another DP that is initialized to 0.
If this DP is = 0 when “units ending movement on this map” is performed then allow the hide, and also set that DP to 1.
Subsequent “units ending movement on this map” will see that that DP is not 0 and abort the hide process.