Game Piece Inventory Window

Hello, I’m having trouble grokking what should be a pretty straight forward problem. I’d appreciate a little guidance.

I’ve added a Game Piece inventory Window to my module that will keep track of any cards in each player’s hand. There are going to be other game pieces in the Hands but these should not be tracked. I only care about the cards and I only care about the cards in the Player Hands.

The name of the Player Hands are: West Hand, Axis Hand, Soviet Hand.
Each Card has a marker labeled “CardCount” and is assigned a value of 1. Other pieces do not have this marker at all.

So, my thinking is I need to make sure to edit the “Show only pieces matching these properties:” box appropriately and that should pretty much do it. I currently have: {(CurrentMap=~West Hand|Axis Hand|Soviet Hand) && CardCount==1}
in the box and that causes the following error to pop up in the chat box:

 - Bad Data in Module: Expression evaluation error Expression={(CurrentMap=~West Hand|Axis Hand|Soviet Hand) && CardCount==1}, Error=

I’ve used the first half of the code before and it worked just fine so my problem is in evaluating the CardCount marker. Obviously, I’m doing it wrong. How can I keep track of the cards (ans only the cards) in the Player Hands?


If you click on the little Calculator icon at the end of the properties field you will get the Expression Builder and you will notice a red cross next to the field. The red cross indicates that the expression is invalid. Hence the error.

If you are going to type in expressions directly, rather than using the Expression Builder, then you should always open the Expression Builder after you have finished to check whether or not the expression you have entered is valid.

Expressions within {} must be pure Java syntax. Any text used for comparisons must be enclosed within double quotes, so the correct expression is

{(CurrentMap=~"West Hand|Axis Hand|Soviet Hand") && CardCount==1}


The code I posted does validate. There’s a green check, not a red x. I’ll try out the quotes when I get home. Thanks for the response!

Hmm, not when I try it

It won’t validate for me either unless the double quotes are added : “West Hand|Axis Hand|Soviet Hand”

Oh, you were correct. It did NOT validate. sorry about that. I added the quotes but now I get this error:

Bad Data in Module: Expression evaluation error Expression={(CurrentMap=~"West Hand|Axis Hand|Soviet Hand") && CardCount==1}, Error= inline evaluation of: ``_xyzzy=_plugh();'' internal Error: Unimplemented binary String operator

any ideas?

It’s been quite awhile, but I think you are probably going to have to add CardCount to everything that could conceivably land on this map window–just set the value to 0 for everything that isn’t a card. This is what I had to do for Virgin Queen to distinguish between tallies of home cards, normal cards, and treasures.

I was afraid of that. Okay, thanks for the info. I’ll let you know how it goes.

Problem solved. It turns out it was indeed a syntax issue. Probably stemming from switching over from a simple expression. I also added CardCount to any possible entities as Joel suggested.

{(CurrentMap== "West Hand"|| CurrentMap == "Axis Hand" || CurrentMap== "Soviet Hand") && CardCount==1}

That code works just fine. Thank you to both Brent and Joel.