Here are the critical e-mails between jrwatts and me that led to a successful resolution to my problem.
From jr watts: Ah, well, for a simple way to let everyone see how many cards are in each player’s hand, a Game Piece Inventory Window (GPIW) will work fine, and it already has a built-in way of showing a count of the player cards. The Terraforming Mars (TfM, for short) I’m familiar with the game module I’m working on (available from the VASSAL module pages) has two of these windows, as players have 2 different hands (a “Research” hand and an actual card hand). I have two card decks which will both need to be counted in the player’s hand for a total You can download that module and look at the “Cards in Hands” and “Cards in Research” GPIWs for examples Thanks.
First, you will need some way to identify which maps in your module are actually player hands I have three hands which are all Private Windows and each has a Map Board with a Board zoned by a rectangular grid. Will these be sufficient to identify them? . TfM does this by giving each map a Global Property (GP), named “map”, with a value that identifies what type of map it is (“hand” for regular player hands, “research” for player Research hands), but, if your hand maps are labeled consistently, you could get away without this GP (for example, if all your hand maps contain the word “Hand” in their name They do. , that can be used to identify them). Also, every card needs a way to identify it as a playing card: TfM gives every card a marker called “type” with the value “card”, but you could also just use the CardCount marker I already suggested you add. My two card types each have a Game Piece Prototype Definition. If I add a CardCount Marker to each of these Prototypes will that achieve the objective?
So, for the following, I’ll assume there are 3 players: Red, Green, & Blue, and their hand maps are called “Red Hand”, “Green Hand”, and “Blue Hand”, and you didn’t add any extra markers or GPs beyond the CardCount marker I previously suggested. At this point, that is the correct assumption. I haven’t put any Global Properties in yet. I’m going to have to revisit your previous posts to see what I need to do here
For the following operations, I am going to spend some time checking that I have complied with your instructions so far and then tinker with the GPIW. Once I’m happy I have done this, I’ll let you know.
In the GPIW settings, you would set "Show only pieces matching these properties to {CardCount == 1 && CurrentMap.contains(“Hand”)}. You would set “Sort and group by properties” to “CurrentMap”, and “Label for folders” to something like “$CurrentMap$: $sum_CardCount$ card(s)”.
This should give you a GPIW that shows you 3 lines, “Red Hand: x card(s)”, “Blue Hand: y card(s)”, “Green Hand: z card(s)” (where “x”, “y”, and “z” are replaced with actual numbers, of course). Note that anyone with an empty hand will not be listed at all, and if no one has any cards, the window will just appear blank; I can’t think of any easy way to avoid that.
As for warning a player that they have too many cards, there are multiple different ways to do that–you could display some text on their card window if they currently have too many, or pop up a dialog box when they draw an excess card, for example (you could even have the GPIW display some extra warning text, if you want, but you can’t change the text color or formatting, unfortunately). Tell me how you want the warning to appear, and I can help you set that up.
My Follow-up:
I took your suggestion right down to where I said I would see how things looked and all appeared well. I then filled out the GPIW in line with what you indicated and gave the module a test run…BINGO! The number of cards in each hand were correctly displayed - however, the names of each card held were also displayed - until I realised the Label for Pieces still contained the PieceName ID; once I deleted that, I just got the numbers of cards. This worked for both card types and card play or discard was also registered by the Count.
All-in-all a very satisfactory outcome and, what’s more important, I actually understood what was happening!
My heartfelt thanks go to jrwatts for his unstinting help and to Vassal for the quality of their customer service.