3.5.5 - Deck does not reload before distributing cards

I have a deck of cards in a hidden window and the cards are drawn via a Draw button in the player’s window. Discards are sent to another deck in the same hidden window.

When the last card is drawn from the Draw Deck, it sends a command to the Discard Deck to send the cards back to the Draw Deck. This is working fine.


The player normally has 4 cards in their hand and plays one during their turn. They would then draw a new card to replace the old one. The player also has the option to pass their turn by throwing away all 4 of their cards and drawing 4 new ones.

This works fine unless the Draw Deck is down to less than 4 cards. For example: if the Draw Deck only has 2 cards left, it will send the two cards and it will then transfer the cards over from the discard pile like it’s suppose to but it won’t send the remaining two cards owed to the player.

How are players drawing cards? Drag and drop? You don’t say.
P.s. How are you hiding a window?

It sounds like you’re drawing the 4 cards with a Global Key Command?

As a way of “not being even slower than they already are”, Global Key Commands establish a list of “what’s in what decks/stacks/locations everywhere on the map” before they attempt to apply the filter conditions to them. That means if your deck starts with 2 cards in it, that it will find those, but if more cards arrive in the deck “during the Global Key Command” (because it moved the last card out and new cards then arrived), the Global Key Command already had made its list of what is available in the deck and doesn’t know about the new cards.

Although it is conceivable that by Vassal 4.0 we will have changed the architecture of decks (and/or global key commands) enough that this shortcoming can be corrected, such a change seems unlikely in the Vassal 3.x.x timeframe.

One way I have worked around this in my own modules is something like this:
(1) Global Key Command to draw the desired number of cards
(2) Second Global Key Command to “fill my hand to my hand size” (e.g. if I have fewer than 4 cards, draw the number needed to get to 4).

Another way to work around it would be to send successive GKC’s, one at a time, to draw single until you reach 4. That might be a little slower, although using the new “fast match” stuff it might not be too bad.


Thanx for the thorough explanation. I wasn’t sure if it was a bug or not

I’ll just set a looped trigger to set off the GKC 4 times. That’ll fix it.

…and in answer to shilinski

Cards are drawn using a button in their players window that triggers a GKC to get the cards from a hidden window.

I use a hidden window in all my mods called Resources. I allows me to keep all the decks, pieces, etc. off the maps and interfaces. Screen real estate can be hard to come by is some Vassal mods so I like to keep as much stuff off the maps as possible and just make them accessible via buttons or menu commands.

I hide a map by just placing a Toolbar Menu just over the Map Window in the main editing tree. I leave the Button text, Tooltip text, Button icon, and Hotkey / Key Command blank, and in the menu entries, I put the button text entry from the map properties (which I usually just use the name of the map, in the case Resources). With the toolbar controlling the map window and the toolbar having nothing to display in the menu bar, that effectively hides the map.