Page 1 of 1

Getting a nesting value

PostPosted: September 12th, 2012, 2:27 am
by shadowagl
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?

Re: Getting a nesting value

PostPosted: September 12th, 2012, 8:20 am
by barbanera
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.

Re: Getting a nesting value

PostPosted: September 14th, 2012, 1:41 am
by shadowagl
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?

Re: Getting a nesting value

PostPosted: September 14th, 2012, 8:14 am
by barbanera
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.