Turn-Based Global Hotkeys and Global Key Commands

Hello

I’m working on my first VASSAL module and unfortunately I’ve hit a brick wall with it. I was wondering if anyone had any words of wisdom that they’d like to share.

The Designer’s Guide suggests that you can use a Turn-Based Global Hotkey to trigger a Global Key Command (Map Window Level), which then could be used to activate a Key Command.

NB I’ve used inverted commas below to help with clarity. They aren’t present in my module configuration.

My idea was to have a turn called “Night” which would then apply Map Shading (Type: Background) also called “Night”, which worked in conjunction with an Area of Effect Unit Trait called “Night Vision”.

Now I can toggle the [Map Shading] on and off using its Toolbar button or its Hotkey Ctrl+D, and it works perfectly with the Unit’s Area of Effect. However I can’t get VASSAL to do it automatically based on what turn the game is currently in. Is this possible?

I have a [Turn Counter] called “Turn” with a [Counter] called “Day” and a nested [List] called “Time”. There are several “Time” values. One of them is called “Night”.

I have a [Global Hotkey (Turn)] called “Night Vision” with the Global hotkey Ctrl+P and its Match Properties is {Time==Night}.

NB I used the expression builder tool for this, but I guessed that the 2nd part would be the same as the Time value that I was looking to match, and be written in that format. I’m prepared to be wrong.

I also have a [Global Key Command] in the Main Map hierarchy called “Make it night”. Its hotkey is Ctrl+P and its Global Key Command is Ctrl+D.

The Global Key Command doesn’t activate the [Map Shading] when triggered either by its “Make it night” Toolbar button or the Hotkey Ctrl+P. I’m not sure what I’ve done wrong. Any ideas? Hopefully if that’s fixed the [Global Hotkey (Turn)] will then trigger it. Or is there a possible gremlin in there too?

If anyone has any advice on this, I’d be very grateful. Although I’ve played a few games on VASSAL before, I’ve only been trying my hand at module design for a week and I’m wishing I’d started earlier. There’s so many possibilities!

Thanks in advance.

Perhaps your mistake is that you have {Time==Night} instead of {Time==“Night”}? The former looks for whether the value of the property Time matches the value of a property Night, while the latter looks for whether the value of the property Time is Night.

I have run into this problem in the module I’m working on…

Global Hotkeys are not the same as Global Key Commands…

So if you trigger a Global Hotkey using the Turn advance and then try to look for Key Commands - it won’t work…

Unfortunately, the Turn Counter doesn’t support an optional Global Key Command, only a Global Hotkey… And there are very limited ways to link a Global Hotkey to a Global Key Command. The only way I know of is to define a toolbar button Global Key Command, which does have an input field for hot keys.

I have an Enhancement request in to fix this problem…

As a quick thought. don’t use the built in Turn Counter.
Have/make a turn/time track label the zones. Day / night
Have a turn marker
Define a global property say “Current_Turn”
Then you could use Current_Turn = turn marker(current zone)
Have that checked when you use a toolbar button to advance current Turn

The COIN modules use something like that. on the record tracks.

What more ways do you need? That is a very powerful mechanism.

Just create a Folder in your module called ‘GHK to GKC Translators’, create any Toolbar Buttons you need to transform GHK’s to GKC’s, add desciptions, remove the icon and button text and you have a compact, documented list of invisible GHK to GKC translators.

The boat has long since sailed when traits can be changed to react to GHK’s or components to GKC’s.