Implement action button with complicated trigger condition

Dear vassal module developer comunity,

I need you suggestion how I can implement following function. I want to enhance a module “la bataille de la moscowa” on an action button which shall look for all “Exhausted” counters [attachment=1]Exhausted.png[/attachment] on the map and remove them if they are not stocked with another counter “Plus Grand Disordered” see picture. If any “Plus Grand Disordered” is found this stoke shall be ignored.

My attempt to use for this Global Key Command has actually failed as the command config does not consider any further marker presence on the same hex. My further research also did not give me a proper solution. Last hope is only your experience and know how.

Thanks in advance,
Serge Sasov

Hi Serge,

I have been using the new Count() function for the purpose that you describe, with a condition that limits the count to the location and counter type of interest.

Does this help, or shall I provide some more details?


Hi Mark,

Thanks for the hint. Could you pls share a little details about your solution.
I tried to use ZoneGlobalProperty (assign a value PGD to the ZoneGlobalProperty if PGD counter is placed) and Global Key Command, but this did not work.

Many thanks,

Hi Mark,

I was pretty sure I had replied to the message, but seems not (or it is still on validation for newcomers, will find out soon).
First of all thank you for the hind and could you pls share the details of your solution.

I have also tried to use zone global attribute to keep there a mark that the hex contains the PGD counter. Surprisely it does not work in conjunction with Global Key Command (the Global Key Command itself work well if I do it without the Zone Global Attribute check). Maybe I’m doing something wrong, unfortunately there is no way (at least known for me) how to debug the flow, therefore I cannot clearly identify what is wrong with my attemt. Hope your solution is much better :slight_smile:

Waiting for your reply!

Hi Serge,

Suppose that you wish to use Restrict Command to prevent execution of a Key Command on the Exhuasted counter if it is stacked with a PGD counter.

To the PGD counter prototype or directly on the PGD piece(s), let’s add a Marker called “Type” with a value of “PGD”.

Now, I think that you could use the following expression in your Restrict Command to achieve your goal:-

{Count("{CurrentX==$CurrentX$ && CurrentY==$CurrentY$ && Type==“PGD”}",CurrentMap)}

It maybe possible to use LocationName instead of X/Y.

Does this help?


Hallo Mark,

your advise to use the count function has really helped to solve the problem. I have applied it to a new calculatable property CalculatedPGD on the Tired marker:
Count("{CurrentX==$CurrentX$ && CurrentY==$CurrentY$ && PGD_Name == “PGD”}", CurrentMap)

and used this for further GKC condition and this works really well:
{CalculatedTired == “0” && Exhausted_Name == “Tired”}

By the way, seems the count() returns the string, therefore I had to enclose the result in the quotes, seems my first bug is found in vassal project.

Could you also assist me with the Multi-Action Button. I have created a couple of GKCs, as input name for button I tried to use the title of created GKCs, but this did not work. Now I’m a little bit confused because I do not know what shall I use as button name of a Global Key Command.

Will be very appreciate to you for the hint!

With regards,

For a multi action button, first create an ordinary button for each action, give each button a name (ie the field that causes the button to have a name on screen). These buttons will, of course, appear in your module’s command bar. Fear not…
Now create the multi action button, using the names of the buttons previously created. Those buttons will now be replaced by the multi action button. Does that help?

As far as I understand it, data type is asserted only during the evaluation of an expression, which in turn may depend on the order of the elements of your expression. There is a recent thread where this was kindly explained to me and I was able to adjust my expression to get the desired result. That said, I am not sure why your Count() example doesn’t work.


Hallo Mark,

To be honestly I found for my case a little easer solution → I have simply assigned a hot keys to my GKCs and created just one action button where I trigger these hot keys in the required order. That’s work really well.

To hide the GKCs buttons I removed all pictures and text out of their title and seems this has worked (not sure this is not a bug, but it suits to my needs so far :slight_smile:).

Thanks a lot for your great support!