# Example of Counting Expressions in a Deck

**URL:** <https://forum.vassalengine.org/t/example-of-counting-expressions-in-a-deck/3685>\
**Category:** General Discussion\
**Created:** [February 22, 2011, 8:15pm UTC](https://forum.vassalengine.org/t/example-of-counting-expressions-in-a-deck/3685 "2011-02-22T20:15:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BigAl737](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/b/53a042/32.png) [@BigAl737](https://forum.vassalengine.org/u/BigAl737)\
**Post date:** [February 22, 2011, 8:15pm UTC](https://forum.vassalengine.org/t/example-of-counting-expressions-in-a-deck/3685/1 "2011-02-22T20:15:00Z")

</div>

Can someone recommend a module that uses counting expressions in a card deck? I want to use this feature to count the number of like pieces on a map. I’ve read the example from the help page (appended below) but have not got it figured out yet. Thanks very much.

Allan

> [@](#):
>
> EXAMPLE: You want to create a deck of playing cards, and display the number of red cards, the number of black cards, the number of face cards, and the total number of cards in the deck. Create the deck, check “Perform counting of expressions”. Add the expressions of “red: color = red” and “black: color = black”. Also add the expression “facecards: value \> 10”. When creating your cards, give them a Marker named “color” with the values of “red” or “black”. Also give your cards a Marker named “value” with the numeric value of the card. Then, you can refer to the counts with the map-level properties of “\_red”, “\_black”, and “\_facecards”. The total can be referenced by the map-level property of “\_numPieces”.

---

<div class="post-metadata">

**Author:** ![Tim\_M](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/tim_m/32/2_2.png) [@Tim\_M](https://forum.vassalengine.org/u/Tim_M)\
**Post date:** [February 28, 2011, 2:54pm UTC](https://forum.vassalengine.org/t/example-of-counting-expressions-in-a-deck/3685/2 "2011-02-28T14:54:58Z")

</div>

> [@BigAl737](#):
>
> Can someone recommend a module that uses counting expressions in a card deck? I want to use this feature to count the number of like pieces on a map. I’ve read the example from the help page (appended below) but have not got it figured out yet. Thanks very much.
> 
> Allan

The feature you refer to can only be used on decks and is only found on the deck dialog (naturally). Therefore I am puzzled as to how you would (or even could) use this feature to count the number of pieces that are on a map (which isn’t the same as a deck) like you say you want to ❓

---

<div class="post-metadata">

**Author:** ![BigAl737](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/b/53a042/32.png) [@BigAl737](https://forum.vassalengine.org/u/BigAl737)\
**Post date:** [March 5, 2011, 12:42am UTC](https://forum.vassalengine.org/t/example-of-counting-expressions-in-a-deck/3685/3 "2011-03-05T00:42:55Z")

</div>

> [@](#):
>
> The feature you refer to can only be used on decks and is only found on the deck dialog (naturally). Therefore I am puzzled as to how you would (or even could) use this feature to count the number of pieces that are on a map (which isn’t the same as a deck) like you say you want to

My mistake in phrasing the question. I meant to count the number of pieces in a Deck. I didn’t know how to report this but learned a neat thing from the Carcassonne module. A text label does the job nicely.

In the example below I’ve created an at start stack on the Ump Only board. I’ve expanded out the attributes of the Text Label. (An image is not required to be assigned to this piece)

[attachment=2]PieceCounterTextLabel.jpg[/attachment]

I positioned this stack just underneath the coffee cup on the Ump Only map. The Coffee Cup tracks pieces in the deck that are assigned marker value of “target = true”

[attachment=1]CoffeeCupDeckAttributes.jpg[/attachment]

Now for every piece in the coffee cup with this marker, the text label will report the total to me on the Ump Only window

[attachment=0]CoffeeCupCounter.jpg[/attachment]

Hope that is helpful for someone.

Allan

---

<div class="post-metadata">

**Author:** ![BenWH](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/b/58f4c7/32.png) [@BenWH](https://forum.vassalengine.org/u/BenWH)\
**Post date:** [December 6, 2011, 9:44pm UTC](https://forum.vassalengine.org/t/example-of-counting-expressions-in-a-deck/3685/4 "2011-12-06T21:44:28Z")

</div>

Helped me - thx
