Create account / Log in

Game Piece Inventory Window

Talk about module design ideas and techniques.

Moderators: uckelman, Tim M

Game Piece Inventory Window

Postby Furyn » August 5th, 2015, 6:13 pm

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:
Code: Select all
{(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:
Code: Select all
 - 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?

Thanks!
Attachments
Game Piece Inventory Window.JPG
Game Piece Inventory Window.JPG (84.88 KiB) Viewed 3172 times
Furyn
 
Posts: 19
Joined: May 14th, 2010, 8:38 pm

Re: Game Piece Inventory Window

Postby Brent Easton » August 5th, 2015, 10:43 pm

Hi,
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

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


Regards,
Brent.
User avatar
Brent Easton
 
Posts: 3090
Joined: December 21st, 2007, 3:06 am
Location: Berry, NSW, Australia

Re: Game Piece Inventory Window

Postby Furyn » August 5th, 2015, 11:50 pm

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!
Furyn
 
Posts: 19
Joined: May 14th, 2010, 8:38 pm

Re: Game Piece Inventory Window

Postby Brent Easton » August 6th, 2015, 2:51 am

Hmm, not when I try it
Attachments
eb.png
eb.png (5.03 KiB) Viewed 3153 times
User avatar
Brent Easton
 
Posts: 3090
Joined: December 21st, 2007, 3:06 am
Location: Berry, NSW, Australia

Re: Game Piece Inventory Window

Postby JoelCFC25 » August 6th, 2015, 2:15 pm

It won't validate for me either unless the double quotes are added : "West Hand|Axis Hand|Soviet Hand"
JoelCFC25
 
Posts: 711
Joined: October 12th, 2010, 5:15 pm
Location: Minnetrista, MN

Re: Game Piece Inventory Window

Postby Furyn » August 6th, 2015, 2:25 pm

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

Code: Select all
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?
Attachments
withQuotes.JPG
withQuotes.JPG (78.45 KiB) Viewed 3145 times
Furyn
 
Posts: 19
Joined: May 14th, 2010, 8:38 pm

Re: Game Piece Inventory Window

Postby JoelCFC25 » August 6th, 2015, 5:56 pm

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.
JoelCFC25
 
Posts: 711
Joined: October 12th, 2010, 5:15 pm
Location: Minnetrista, MN

Re: Game Piece Inventory Window

Postby Furyn » August 6th, 2015, 6:17 pm

I was afraid of that. Okay, thanks for the info. I'll let you know how it goes.
Furyn
 
Posts: 19
Joined: May 14th, 2010, 8:38 pm

Re: Game Piece Inventory Window

Postby Furyn » August 6th, 2015, 10:30 pm

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.


Code: Select all
{(CurrentMap== "West Hand"|| CurrentMap == "Axis Hand" || CurrentMap== "Soviet Hand") && CardCount==1}


That code works just fine. Thank you to both Brent and Joel.
Furyn
 
Posts: 19
Joined: May 14th, 2010, 8:38 pm


Return to Module Design

Who is online

Users browsing this forum: No registered users and 0 guests