Help wit deck to perform counting of property expression

I am trying to make a “deck” of coins count the number of coins in the deck; I also want to display the number in a text label. But I just get a label that says 0. Here is my set up.

Global property: P1_1GCount (meaning the count of player 1’s 1 gold pieces), initial value: 0, numeric.

All 1G cards have a marker: P1_1GCount=1

P1_1G Deck: perform counting of property expression is checked. Expression is: P1_1GCount: P1_1GCount=Calculate.

All 1G cards start in a separate map’s deck and each player has a + and - button to send cards to and from that deck to their own 1G decks. So player 1 has a + 1G button with a text label: $P1_1GCount$.

I couldn’t find any helpful instructions on doing this so I really don’t know what I’m doing.

If your deck name is “P1_1G” then the property P1_1G_numPieces will already be exposed automatically by Vassal and will contain the number of pieces currently in the deck without any extra intervention by you. So you can then reference it in your text label as $P1_1G_numPieces$ and it should work.

If you want to count more complicated properties (e.g. total number of GOLD coins in the deck) see the lower stretches of this wiki entry: vassalengine.org/wiki/Deck

Hope that helps!

Brian

Thanks that worked! It’s exactly what I was after. But it only works with 1 gold pieces because the value of the coins is equal to the number of coins. For coins that are worth more than 1G I think it would be better to display the total value of the coins in the deck. For example if there are 3 coins in the 5G deck, it should read 15G. How would I do that? I’m thinking somewhere I need to calculate $P1_5G_numPieces$*5 for that deck. I’ve seen that wiki page you linked but I couldn’t figure out how it could help me.

In the piece that contains your Text Label, add a Calculated Property trait called perhaps TotalGold or something. In the expression field of the property, put P1_1G_numPieces + P1_5G_numPieces*5 (plus any more denominations you need to deal with). In the text field of the Text Label, put $TotalGold$

Brian

Thanks a ton! That did the trick.