Levels follow expression value

Hi,

I have a Dynamic Property on a game piece - “shield_count”. It’s numeric.

I have a layer that has a level with a shield graphic (intended to be an overlay).

How do I turn the layer off (or maybe show a level with no image?) when shield_count = 0? What is the exact syntax for the expression?

I’ve tried every conceivable variation of the likely syntax but nothing works. There don’t seem to be any explicit instructions for doing this, and the manual refrers to an old version of VASSAL. This program really is making me feel extremely stupid…

Any help appreciated.

Looked at another module with the functionality I needed, and got it working. I see there is no syntax to work out - just add the name of the Dynamic Property.

Does the VASSAL layer trait support a level zero, “0”?

I have not tried to get it to use a level zero, as I assumed that levels only use natural numbers (1, 2, 3, …).

The layer image Level starts from 1 by default but there is an option to offset your expression values by setting the base expression value that is to equate to Level 1.

It sounds like you need to adjust the Layer trait by putting a blank image at level 1 and set Level 1 = 0. To insert a blank image - add a new layer then use the arrows to move that blank layer from the end to the top.

You may have a more general syntax issue with the expression you are using… more information would be helpful if so.

There is also the option to use a Key Command to toggle the Activation state off (you likely have this checked as “Always Active”). If the activation state is off, then the evaluation of the layer level will be ignored, I think (it certainly won’t result in any image being displayed).

Mark

Yes, level 1 = 0 is working fine for me.

@Mark - thank you that’s pretty much what I’ve done. Two levels in my layer, first has no image. Follows expression “shield_count”, level 1 = 0. Layer set to always active.

So now a unit can start with shields, and the shield graphic is present until the shield count gets to 0, when it disappears. I suppose I could get really fancy and draw different layer levels of the graphic to represent shield deterioration / overload… Maybe one day.