Create account / Log in

Comparing Properties Between Game Pieces

Talk about module design ideas and techniques.

Moderators: Tim M, uckelman

Comparing Properties Between Game Pieces

Postby twenck » July 25th, 2018, 3:10 pm

I need to have a piece issue a GKC to other pieces that have a matching property.

The Module Designer's Guide has an example in which a counter has a GKC command with matching properties that includes "nation = $nation$".

This works correctly, comparing the property nation on the counter receiving the GKC, to the property $nation$ on the counter sending the GKC.

I need to make a more complex set of comparisons and therefore need to use a Beanshell Expression. I cannot come up with any method to compare property values between two pieces in a Beanshell Expression. I tried:

{nation = $nation$}
{nation = "$nation$}
etc.

Can anyone advise how to compare property values between two pieces using a Beanshell Expression?


Thank you,

Tom
twenck
 
Posts: 19
Joined: October 27th, 2017, 11:15 pm

Re: Comparing Properties Between Game Pieces

Postby DrNostromo » July 27th, 2018, 5:59 pm

Off the top of my head, I believe it would just be

{nation==nation}

The use of $ (dollar signs) to signify variables is a Vassal tool that is not recognized by beanshell but, if you use that syntax, clicking the Expression Builder button should convert Vassal syntax to a Beanshell compatible expression.
User avatar
DrNostromo
 
Posts: 982
Joined: December 21st, 2007, 3:54 am
Location: Wine Country, Cal. USA

Re: Comparing Properties Between Game Pieces

Postby Malnorma » July 28th, 2018, 9:56 pm

It seems unlikely that the same name would correctly refer to different objects without any kind of qualifier though.
Malnorma
 
Posts: 71
Joined: October 14th, 2015, 9:26 am


Return to Module Design

Who is online

Users browsing this forum: No registered users and 1 guest

cron