Anybody ever successfully "count expressions" in a Deck?

Hi Folks,

I’m doing a big pass through all the documentation to update it for Vassal 3.3.3.

Ordinarily I don’t have problems making Vassal stuff work, but when I’ve come to the “Deck” documentation I have had zero success in getting the “count property expressions” feature to do anything (well, I don’t count uniformly returning 0 in every situation to be “anything”). I can’t get “old style” expressions to work, I can’t get “beanshell” expressions to work, and I can’t get “literally typing what’s in the documentation example” to work.

If someone has a module that actually successfully counts expressions/properties in a deck, could you please direct me to the module (or send me the module)?

To be clear: I don’t want an explanation, I want a module that actually does it and works.

Although I would be also interested to know the answer to the following: am I supposed to be able to use either old-style or BeanShell expressions, or will only old-style work?



I have found (remember Im old school so no beanshell here), targeting a deck + marker will work all the time easy.

Lets say you have a deck of 52 cards and you want to know how many clubs are left in the deck after 29 cards have been pulled leaving you with 23.

Use a secret deck

Send all club “marker” cards from deck A (normal deck) to hidden secret board deck, return that secret decks numPieces to a global property, return this deck to original and then reveal value of the captured global property. Seems complex but happens in instance - just a structural thing.

Probably easier ways but this pops off the top of my head and not using vassal in many years

Been there, done that. Documented step-by-step flat out does not work. Back in May, it greatly increased my learning curve for groking the diff between Beanshell and Classic until Brent confirmed none of the Deck and GKC stuff worked as described. Anyway, I’ll PM you my WIP module which uses Deck expression counting ALL OVER THE PLACE. You’ll need 3.3.3-SNAPSHOT-9a9020b4.

PS Both classic and beanshell work. Beanshell though is pending bug fixes scheduled for 3.3.3, but you know that better than me!

Ooh, thank you very much! In return I will put documentation that describes the behaviors correctly into 3.3.3!


PM’ed you a followup inquiry.

If I’m following you–and I think I am–I have a pretty basic implementation that counts cards of a certain suit in a deck. In the game Root, cards have one of 4 suits (Bird, Fox, Rabbit, Mouse). One of the factions (Lizard Cult) collects everyone else’s discards and has to do something at the start of their turn based on which non-Bird suit has the most cards in that pile. I just did the expressions to count how many cards of each non-Bird suit are in the pile and then used them in a Text Label.

Is that what you’re looking for?

Here is the part of the Deck configuration (Deck name is “Lost Souls”):
[attachment=1]Screen Shot 2020-07-29 at 9.31.27 PM.png[/attachment]

Here is the config of the invisible piece with the Text Label trait:
[attachment=0]Screen Shot 2020-07-29 at 9.31.57 PM.png[/attachment]

Yes would be nice to have a slim-and-trim module like that. Please do send me a link or something for that.

Also, from m3tan’s module I have now had some success in using “Old Style” expressions to count things in a Deck, but he says it’s also possible to count them with BeanShell expressions. If you have anything that successfully uses Deck “count expressions” functionality with a BeanShell style expression (i.e. “==” and parenthesis) then I would love to see that.

Updated my post with relevant config screenshots.

Okay super thx. So that looks like “old style” expressions but “tolerates spaces”. All good to know.