Automate counter setup on main board?

I’ve made a lot of VASSAL modules before, but here’s one thing I’m wondering whether it’s possible to do:

I have a wargame with a standard hexmap main board.

The setup of a game requires the player to shuffle 40 counters and place them in random stacks of 4 counters each on on 10 specific-colored regimental setup hexes on the board.

Since the game has 40 counters per regiment and 3 regiments, that means the player has to randomly draw 120 counters in all and stack them on 30 separate setup hexes.

It would be nice to automate this process, instead of having the player do all the drawing and stacking manually. I’m thinking:

What if I made the units as 2-sided card objects instead of counter objects, and had 3 At-Start Stacks, each containing a deck of 40 units for each of the 3 color-coded regiments, set for face-down random draw.

There would be a corresponding colored button on the toolbar labeled “Set Up X Regiment.” At the touch of that button, VASSAL would draw 40 units from the randomized regimental deck and place them in stacks of 4 in each of the 10 designated setup hexes. So, in three button presses, you could set up the game and it would be a different mix of units in the setup hexes each time.

Is such a thing possible with current VASSAL? And, if so, how would it be implemented?

pmail me ( and I’ll send you my War in the Wind module where I made axactly that.

1 Like

This is relatively easy (as far as module automation goes!) to set up. First, understand that the only difference between a generic piece and a “card” is that cards are automatically given a Mask trait, so they can be hidden when flipped upside-down; in other words, you can turn a normal piece into a card suitable for a VASSAL Deck simply by adding a Mask trait to them.

Make sure that your hex grid is configured to use the “Grid Location” as the Location Name, or this won’t work.

Start by creating 3 Decks (not At-Start Stacks) to hold your pieces, ensuring they are set to “Auto Shuffle”; then, move your piece definitions to those 3 decks, and add a Mask trait to each of them, and multiple Send to Location traits, one for each possible destination for that piece.

You then need to add a hidden “control” piece to your board somewhere, which will be used to trigger the “dealing” of the pieces to the board (or, you can add the following traits to an existing piece already placed in an At-Start Stack somewhere). This piece needs one Trigger Action, which will call 30 separate Global Key Commands (aka GKC) to move the pieces to their final locations (you could theoretically get away with fewer, by using expressions to determine the destination hexes, if there’s an obvious pattern to them, but you didn’t provide enough info for me to tell if that’s feasible).

Each GKC will target a specific deck, and exactly 4 pieces within the Deck. It will send the appropriate Key Command to trigger one of the Send to Location traits you added to your pieces. Once all 30 GKCs have triggered, your 120 pieces should be in their starting locations.


Thanks, jrwatts!

Normal pieces can be in a deck. You don’t need a mask trait. Just make sure the pieces are always face up when you configure the deck.

I did something very similar to what you are asking about, in the ‘Banish the Snakes’ module. You can download it from this site and take a look. Below is part of the commands.

1 Like

Brilliant! Thanks Jardic.

1 Like