How does $pieceName$ gets set to Null if you have a Basic Piece Name entered?

I’m currently designing a module with auto reporting movement on the Main Map with:

$playerName$ moves $pieceName$ : $previousLocation$ → $location$

It works fine for most of the counters, but there is a certain type of unit where I get a “Null” value:

* x moves Null : A 60.26 → A 59.27

These counters also show up as “null” in the Module Debug Window.

All these counters have a Basic Piece Name. What would cause counters to have $pieceName$ set to Null?

A Layer trait where you have no names entered for the level(s) of the Layer.

Per the docs:

Each level can be given an individual name, which is used to change the name of the piece for reporting purposes during play. The level’s name either replaces the piece’s normal name, or else modifies the piece’s normal name as a prefix or suffix.

But NONE of my other pieces have names entered for the layer levels, yet they show up correctly.

Text labels can also reset the piece name if configured incorrectly.

All the counters share the same Text Label trait, but only a particular subset have the Null issue.

I tried removing the Text Label trait form all units, but no improvement.

Then it’s most likely an incorrect setting on your Layer traits–compare one that works correctly with one that doesn’t (or post screenshots here so we can).

Note that other traits may also modify the $pieceName$ (or PieceName - see also Properties) property of a piece - for example the Mask and Basic Name traits. However, the property BasicName is always the name of the piece set in its Basic Piece or possibly Basic Name traits.

BTW, be careful about adding a literal into the message format - whether it gets displayed correctly depends on the target machine has the appropriate fonts installed. A better option is probably to use HTML formatting, as in

| $playerName$ moved $pieceName$: $previousLocation$ → $location$

Then, the Java back-end can substitute appropriately. The | at the start, is a way to force HTML formatting - see also Message Formats.

Yours,
Christian

Thanks guys. I was able to find the problem. It was caused by a layer trait name in a prototype used in those counters.

I really do need to start using BasicName for all my reporting.

No worries.

I would advise against using BasicName in messages and such. BasicName will always show the piece name, even if the piece has been made invisible or similar, which can work counter to the game mechanics.

Just make sure you configure something like the Layer trait properly - that will be better.

Yours,
Christian

I would advise against using BasicName in messages and such. BasicName will always show the piece name, even if the piece has been made invisible or similar, which can work counter to the game mechanics.

Thanks, Christian,

I see your point, but in most cases, all I want is the piece name to show up. I really don’t want to populate the layer name in the message, especially in this case, where that layer references a generic image shown in the corner of the piece.

At any rate, the point is probably moot, as I can’t get BasicName (or basicName, Basicname, or whatever) to show up in the message anyway.