Sum of Dynamic Properties

So I am using Vassal 3.2.2. Am I missing something or is there not a way to sum the total of Dynamic Properties in a deck (without writing Java code, which I have no clue how to do)?

I have a cards A, B & C. I set Dynamic Properties and set a CardValue of 2, 4 & 9 (respectively). I toss those cards into a VictoryPoint deck and just want a simple stack item with a text label that says “VP = 15”. I have tried everything and can’t get it to work. :imp:

As each card goes into the deck, you must transfer its value of the Dynamic
property for that card to a Global property using increment by option. You
display the value of the Global Property.

-----Original Message-----
From: messages-bounces@vassalengine.org
[mailto:messages-bounces@vassalengine.org] On Behalf Of wootersl
Sent: Monday, March 11, 2013 4:56 PM
To: messages@vassalengine.org
Subject: [messages] [General Discussion] Sum of Dynamic Properties

So I am using Vassal 3.2.2. Am I missing something or is there not a way to
sum the total of Dynamic Properties in a deck (without writing Java code,
which I have no clue how to do)?

I have a cards A, B & C. I set Dynamic Properties and set a CardValue of 2,
4 & 9 (respectively). I toss those cards into a VictoryPoint deck and just
want a simple stack item with a text label that says “VP = 15”. I have tried
everything and can’t get it to work. :imp:


Read this topic online here:
https://forum.vassalengine.org/t/sum-of-dynamic-properties/5801/1

Sorry. What do you mean, increment by option?

With the Set Global Property trait (which you should be using) one of the
drop down selections for the key command is “increment value by”

Here you can put $MyCardValuePropertyName$ so you can prototype this to all
your cards without having to input all the different values

-----Original Message-----
From: messages-bounces@vassalengine.org
[mailto:messages-bounces@vassalengine.org] On Behalf Of wootersl
Sent: Monday, March 11, 2013 5:15 PM
To: messages@vassalengine.org
Subject: Re: [messages] [General Discussion] Sum of Dynamic Properties

Sorry. What do you mean, increment by option?


Read this topic online here:
https://forum.vassalengine.org/t/sum-of-dynamic-properties/5801/3

Well, I think I have the idea, but it’s not working. I’m getting an error: “Set Global Property (): Unable to locate Global Property named 0”

I have setup a prototype that when you right click you can send a card to a player’s Victory pile with a trigger action. It sends the key command “CTRL SHIFT 1”.

Then I have “Set Global Properties” that watches for “CTRL SHIFT 1” and that sets “{VPTotalPlayer1}” (which I have as a Global Property) by increment value of “$VPValue$”. Not sure why I am getting the error.

The problem is where you have set the name of the global property to be changed to

{VPTotalPlayer1}

{} says evaulate whatever is inside, so it using the contents of VPTotalPlayer1 as the name of the global variable i.e. 0.

The correct thing to use here is

{“VPTotalPlayer1”)

or, just leave the {} off and use the gp name directly as

VPTotalPlayer1

Regards,
Brent.

Finally! Thank you very much! :smiley:

I too was having similar problems with the “Set Global Property (): Unable to locate Global Property named 0” error.

The issue is that when you use the “Expression Builder” button to insert the global property, it automatically adds the curly brackets {} around the gp name. Thus you have to manually remove the brackets or add the quotation marks to get it to work.

Can this default behaviour be changed?

Hmm. This is more complex than it sounds.

The Expression Builder always returns an expression (i.e. something in {}). And generally, this is exactly what you want, EXCEPT in this particular case which is the one place where the Expression Builder is used to return the name of a Property. In which case you still want an Expression returned as normal EXCEPT when your expression consists of a single Property reference, in which case you want that to be the property name ({“propname”}, simplified to propname).

Whew! I can see what I need to to do, but it will take a bit of coding. Leave it with me.

Brent.