Create account / Log in

Getting a nesting value

Talk about module design ideas and techniques.

Moderators: uckelman, Tim M

Getting a nesting value

Postby shadowagl » September 12th, 2012, 2:27 am

Here's my problem looking for help:
I define 2 Global Properties:
"Player1Role" values "Batman"
"CurrentPlayer" values "Player1"

Now I want to get the "Batman" through "CurrentPlayer", I wrote "$$CurrentPlayer$Role$" in the report format, it was not working right. Is the expresstion not correct or it just not support this nesting value?
shadowagl
 
Posts: 25
Joined: May 18th, 2012, 7:26 am

Re: Getting a nesting value

Postby barbanera » September 12th, 2012, 8:20 am

You need Vassal 3.2.0 for this, then you use something like GetProperty(CurrentPlayer+"Role"). Don't remember if Report Actions take in-line expressions. If they don't, define a Calculated Property with that expression first and report that instead.
barbanera
 
Posts: 395
Joined: January 12th, 2012, 2:27 pm

Re: Getting a nesting value

Postby shadowagl » September 14th, 2012, 1:41 am

barbanera wrote:You need Vassal 3.2.0 for this, then you use something like GetProperty(CurrentPlayer+"Role"). Don't remember if Report Actions take in-line expressions. If they don't, define a Calculated Property with that expression first and report that instead.


Thanks for replying!
I updated VASSAL to 3.2.0-beta1.
What is "in-line expression"?
Error message showed when using GetProperty, details below:
1.Add a Calculated Property trait, set Property Name as "abc", Expresstion as "GetProperty(PlayerSide+"Role")"
2.Add a Text Label trait, set Text as "$abc$"
The result was, the Text Label didn't show the Global Property "Player1Role", and console said: - Bad Data in Module: Expression evaluation error ActionCard-Calculated Property[abc]={GetProperty(PlayerSide+"Role")}, Error=Method Invocation _interp.getProperty

I tried to find some guidelines of this new trait, but the help file "D:\Program Files (x86)\VASSAL-3.2.0-beta1\doc\ReferenceManual\ExpresstionBuilder.htm" is missing.

Would you please show me a simple example how to use this powerful function in VASSAL 3.2.0?
shadowagl
 
Posts: 25
Joined: May 18th, 2012, 7:26 am

Re: Getting a nesting value

Postby barbanera » September 14th, 2012, 8:14 am

An in-line expression is just what you enter in the "expression" line of a CP (or similar entry prompts for other traits in 3.2.0). The language is Java's Beanshell.

You got it right but it didn't work for you because GetProperty was buggy in beta1. You need to download the latest 3.2.0 build from http://www.vassalengine.org/~uckelman/builds/ or wait for beta 2, which should be released very shortly.
barbanera
 
Posts: 395
Joined: January 12th, 2012, 2:27 pm


Return to Module Design

Who is online

Users browsing this forum: panther 2010 and 6 guests