How to show the number of cards remaining in a deck?

Hello, and thank you for looking. I’m still learning my way around Vassal, and haven’t been able to figure this out.

I’m creating a module that features two different draw decks. I’d like to implement some feature that allows any player to see how many cards are left in a draw deck.

Ideally, I’d like to include this as a right-click command. But I would also be willing to have an actual number on the draw deck indicating the number of remaining cards.

Any advice? I think the answer lies in the “Expressions to count” feature of the draw deck. Unfortunately, I’ve read, re-read, and re-re-read about this feature in the Reference Manual, and it’s still not making sense.

The manual reads: “The number of cards in the deck is exposed as a Map-level Property with the name _numPieces.” Can someone please expain what this means? Where exactly is the number exposed, and how do I expose it?

Thanks for your help! :slight_smile:

There is an example on my Blackbeard module

*********** REPLY SEPARATOR ***********

On 9/02/2008 at 11:02 PM Donegal wrote:

Sounds like a great idea for a How-To! (vassalengine.org/wiki/doku.p … ow_to:main)


Brent Easton
Analyst/Programmer
University of Western Sydney
Email: b.easton@uws.edu.au


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Maybe tim will let you borrow some code. Each of the 7? decks got a number for cards left in deck.

Lorentz

Thanks for posting this - I checked out Blackbeard and the card counter is exactly what I’m looking for!

I’ll report back after attempting to recreate these counters in my own module.

Thanks again!

How to show the number of specific cards in a deck?
For example, the deck has 48 cards. 12 cards are a special feature, and I want the number of this cards -12- appears next to the deck with the total number of cards -48-. How do it?
Thanks for advance

Look at the help for Deck and read the third example. Once you do that, you should configure the moust over stack viewer to display the counts.

  • M.

2009/1/21 packonn <messages@forums.vassalengine.org (messages@forums.vassalengine.org)>

Post generated using Mail2Forum (mail2forum.com)

I’m just guessing here as I haven’t fooled with displaying the number of cards in a deck but if the Blackbeard module displays the number of cards in a deck, then I would imagine you could also display the number of special cards in a deck by giving those special cards a Marker of some kind.

…am I right? …or does this process that counts the cards unable look for a Marker property?

2009/1/21 Dr_Nostromo <messages@forums.vassalengine.org (messages@forums.vassalengine.org)>

I think it absolutely must count a Marker property. If you want to count all the cards, they all have to have the same Marker property.

  • M.

Post generated using Mail2Forum (mail2forum.com)

Not quite

$deck_numPieces$ (think thats the property been a while) which counts all the cards in a deck does not rely on a marker nor need one.
But, to display specific number of cards in a deck though you are correct that the significant pieces would need a special marker and the you would have to use the “perform counting of property expressions” in the Deck dialog and refer to that instead

From: Michael Kiefte mkiefte@dal.ca
To: VASSAL Engine Forums Mailing List messages@forums.vassalengine.org
Sent: Wednesday, January 21, 2009 9:25:52 AM
Subject: Re: [Module Design]Re: How to show the number of cards remaining in a deck?

2009/1/21 Dr_Nostromo <messages@forums.vassalengine.org (messages@forums.vassalengine.org)>

I think it absolutely must count a Marker property. If you want to count all the cards, they all have to have the same Marker property.

  • M.

Post generated using Mail2Forum (mail2forum.com)

Blackbeard Module has an At the Start Stack (Action cards count) with a single piece. This piece has the trait Text Label. This trait (Text:$Action cards_numPieces$) and the Expression to count “action:card=action”, shows the number of cards (“card” is a Game Piece Prototype Definition)
I tried the same procedure to show a specific number of cards into the deck, but unsuccessfully.
Tim: What’s the expression I write in the Perform counting of property expression?

Problem solved!
A Marker to each special card, an expression to refer these cards, and $nameDeck_expression$.
You can see it in this module that I’m creating (two counts for two groups of special cards and a count for the total number of cards)
Thanks to all!
amarocimarra.googlepages.com/NE