Moving & Counting Cards

I have a deck of action cards on my main map board. These can be drawn singly or in multiples, be shown face up or face down (players’ choice) and then sent to various locations (Player hands, discard pile, back to the deck) and, when played to trigger the action, sent to one of three player areas for all players to see.

Here is a screen shot showing the Prototype of an action card: [attachment=1]Prototype.jpg[/attachment] and a single card: [attachment=0]SingleCard.jpg[/attachment]. Each of the action card single pieces in the deck has the Basic Type and Prototype traits but nothing else.

When I run a game, all the “Send To Location” options are greyed out on the right-click pop-up menu. I’ve tried changing the order of the traits but this has no effect on the greying-out.

Can anyone tell me what I might be doing wrong?

I also want the module to count the number of cards in any player’s hand at any one time and, possibly report if a certain number of cards is equalled or exceeded - is there a way to do this?

Greyed-out ‘Send To Location’ traits usually indicate that the destination location is badly defined, invalid or not accessible.

OK, Brent, thanks. I’ve double checked the zone definitions and can’t see any obvious errors (not to say there aren’t any) and the fact that it’s happening with all four “STL” traits suggests it’s something fairly basic that I’m getting wrong. I’ll delete the zones that I’ve defined, re-draw them and hope that sorts it.

Any suggestions for what I’m most likely to have messed up?

That didn’t seem to work. I have to take a break but would still welcome any suggestions you have.

I sorted it! Vassal enclosed the name of the target zone in wavy brackets. Once I took them off, all went as intended. Not sure how that happened but it wasn’t intentional.

Now all I need to know is how to count the number of cards being held in a player hand - any suggestions?

I think you can use a global property : CardNumber for example
when you draw X cards, you trigger the update of the property
when you play/discard or any other action, you update the property

Give each card a marker (call it CardCount or something like that) with a value of 1. Then, you can use Count(“CardCount == 1”, “”) in a Beanshell expression to get a count of all the cards in a particular hand. (This was a new feature of 3.4, and I think it’s only documented on this page:http://www.vassalengine.org/wiki/VASSAL_3.4_Release_Notes.)

Thanks guys. I’ll try both of those to see which I prefer. For anyone else following this, I’ll report back soon.

I have been receiving help from jrwatts on a private basis to avoid swamping this forum with my incompetence. Hopefully, the help I am getting will enable me to provide a summary for people following this thread.

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.