Need some assistance with Turn Counter, Action Button, Global property

I am extremely new to Vassal Module creation\modification. Something I want to do but I am not exactly sure how to do.
Starting from the Turn Counter. Say you have a List such as:
1.0 Determine Initiative
2.0 Move Units
3.0 Declaration of War
3.1 Resolve all Battles
3.2 Check for out of supply
3.3 Check Moral
3.3.1 Resolve Panic
3.4 Mark off ammunition Expenditure.
4.0 Second Side’s Impulse (Go to Step 2.0)
5.0 Gather resources
6.0 Plot Builds
7.0 End of Turn
What I want is that when the Turn Counter is at 4.0, a Button appears on the Toolbar for a Player to click that will send the Turn Counter back to 2.0
During any other phase of the Turn Counter, that button is disabled on the Toolbar and if the button is not clicked and the Turn Counter is advanced to 5.0, that button disappears from the Toolbar.

What I think needs to be done is:
1.0 Create a Global Property with an initial Value of 0 (thus representing False)
2.0 Add 2 Global Hotkeys to the Turn Counter
2.1 One for setting the Value of the Global Property to 0
2.1.1 Set to 0 any time the Turn Counter is NOT at step “4.0 Second Side’s Impulse (Go to Step 2.0)”
2.1.2 Set to 1 when the Turn Counter is “4.0 Second Side’s Impulse (Go to Step 2.0)”
2.2 One for setting the Value of the Global Property to 1
3.0 Create an Action Button from the Module Name
3.1 This Action Button is the Button that appears on the Toolbar when the value of the Global Property is set to 1 and Disables the button with the Value of the Global Property when it is set to 0.
Is this essentially correct? I am not sure how to make this work. Is there a better way or could someone give me some assistance here and instruct me on how this can be done?
Thanks,
Mike

I don’t think you can make a key that only appears on a certain condition, but you can make a Global Key command that is only enabled when a certain Global Property has the value of “true” (not 1 but “true”).

I figured I could use an Image file for the button and another that is of the same color as the toolbar to make it appear as if it is not there (when disabled). My real issue is to make this all work as the documentation has no real examples I can work from.

You can’t rely on the user’s toolbar being any particular color.

Ok fine, I can’t make it the same color. But the process of making this all work is where I need the help. Is it the correct process or is there a better way?

It’s a big list of actions you list above. I can warn you ahead of time, there is a cost in latency when the turn counter does too many things Global Key Command (GKC) actions at one time. Presumably these actions above would happen on different turn clicks to spread out the GKC actions, but Vassal must look at every piece on the map to determine whether the GKC affects it or not and it can take a few seconds of time to do so depending on how many counters are involved.

You can take a look under the hood of my module for Siege of Jerusalem where I built in GKCs to perform all of the inter phase assault actions for the game, to move the count the counters, calculate the percentage of reinforcements, divide the counters to the dead pile or the return pile, calculate Victory points, and such. Look specifically at the Turn Counter GKCs and their relationship to actions on the Interphase Board.

Warning. Siege of Jerusalem is admittedly an overbloated exercise in excess. But was also a labor of love. I wanted to see just how far the Vassal Engine would allow me to put rules into a module. As a further note, I am not a coder, so all of my work is done from the wizard from a user perspective.

1 Like