Deck and number of cards in different places

I have one Deck in a Player Hand window, and I want to know the number of the cards in the Main Map. It is possible? Thanks.

Yes, you can have it reported in the message window via a toolbar button or a right-click trigger in the cards… or you can have a label placed on the main map itself (or in the player hand window) showing the current amount adjusted automatically. I’ll detail the toolbar button method below, quoting from the designer’s guide pg 48 (as that same method was just referenced in another question). If you have any questions on any of it, just ask.


[don’t use quotes]

Totaling the Number of Pieces on a Map

You can use the Marker Trait in conjunction with the Set Global Properties Trait to sum the number of pieces on a map.

  1. Create a Global Property called “PieceTotal”.

  2. For the new Global Property, create a Change-Property button called “Zero Total” that will set PieceTotal to “0” (In Type, choose Set Value Directly).

  3. Create a Marker on each piece you want to add to the count. Name the Marker “Count”, with a value of “1”.

  4. Create a Set Global Property Trait on each piece, which will increment PieceTotal by 1.

  5. Create a Global Key Command called “Total Pieces”. For Global Key Command, use the keyboard shortcut of the Set Global Property Trait you specified in Step 4, and in Matching Properties, enter “Count = 1”.

  6. Create a Toolbar Action Button called “Count Report”. Check Display Message, and enter “Total Number of Pieces on Map: $PieceTotal$”.

  7. Create a Multi-Action Button called “Total”, and add the “Zero Total”, “Total Pieces”, and “Count Report” buttons to it.

Now, when the Multi-Action Button is clicked, PieceTotal will first be zeroed out (to remove any previous totals), then each piece will add 1 to the PieceTotal, and the Action Button will report the total in the chat window.

Thinking about it… you’ll need to add an additional matching property to step 5: that being your main map’s name. So step 5 should read:

5. Create a Global Key Command called “Total Pieces”. For Global Key Command, use the keyboard shortcut of the Set Global Property Trait you specified in Step 4, and in Matching Properties, enter “Count = 1 && CurrentMap = [name of your main map]”.

So the Count = 1 marker would be placed in all the cards of your deck (preferably into a prototype trait for the cards), then step 5 singles out only those cards on your main map.

Thank you very much rrvs! I will follow your instructions carefully. Greetings.

I may be totally dumb, but I found no way to add a text label (that would include an expression like $deck1_numPieces$) directly to a map window, map or map board. Please, what am I missing? (VASSAL 3.2.17)

Hi, you’d use an at-start stack, not movable or selectable, lowest board layer if using that… the piece would use no image and have a text label trait with whatever expression as its text. That said, that quoted example would only work on the same board the deck was on. With a little work though you could turn that count into a global I suppose and then use it elsewhere.

Ah, I see. Tricky. Thanks for the fast reply, I’ll try that!

I think that would be taken care of by the “apply to pieces on this map only” checkbox.

I think it was a main toolbar gkc. But yeah whatever works, definitely. :slight_smile: