How to use a Global Key Command to reset a layer on all counters

From VASSAL
Jump to: navigation, search

A very common application of layers in a module is a status marker to indicate that something has happened to that counter this turn. For example, a Fired marker to indicate that the unit has already fired it's weaponry this turn.

At the end of the turn, we need a function to reset the fired markers on all counters that have fired. The component to use to do this is a Global Key Command, which sends a specified Key Command to a set of counters.

:how_to:gkc_reset_gkc.png

We have to be careful to send the Ctrl-D command to only those counters that actually have the layer showing, otherwise we will turn off all the markers that showing, but also turn on all the markers that are not showing.

The key is to use the Matching properties field to only select counters that actually have the marker layer activated. Here we are using Mark_Active = true. Let's have a look at the actual layer definition:

:how_to:gkc_reset_layer.png

The key is that the Name of this layer is Mark and the Matching properties specified in the Global Key Command is Mark_Active = true which says 'Only apply this Global Key Command to layers with a name of Mark that are currently activated.