Incrementing a global property

I’m working on a mod where the players collect cards, each with different numeric point values. At the end of the game, the points on the cards are totalled to determine the winner. The module should track these points automatically so players don’t have to, so I’ve assigned a dynamic numeric property (called Score) to each card with its point value, and set up a Global Property corresponding to each player’s Score (RedScore, BlueScore, etc).

When the player collects the card, it removes the card from the board, and should then add its Score value to the player’s total (Using the Set Global Property trait, I picked increment the global property by the value of the card’s Score–that is, Increment by $Score$).

However, when I run the command, an error is returned saying, “Bad Data in Module: Numeric field contains a non-number Increment $playerSide$Score: format=$Score$, value=Score” Does this mean that the incremented value needs to be a hard-coded number? It doesn’t seem to be finding the value for Score even though I know the card has one. (If I put in a hard-coded number, this works just fine, but each card has a different Score.) Each card’s Score is marked as a Numeric property.

The help file on Global Properties isn’t clear on how this works. It says, “Increment numeric value adds a fixed value to the property, after substituting values of Properties [defined for this game Piece].” What does this mean?

Funny you should bring this up as I’m working on a game system that does almost exactly the same thing.

First, make sure the Dynamic Property value of the card is above the traits that use it. Why that is, I don’t know …it seems to me you would want to establish the card value before adjusting the Global Property but it doesn’t work that way.

Also, I may have discovered a bug with this system that the good folks at Vassal are looking into …but that’s beside the point. The test module I made for reproducing the bug does exactly what you want. You can download it from this thread:

[url]https://forum.vassalengine.org/t/out-of-synch-global-properties/3460/1]

Thanks Doc! That did the trick. Works great now!

The order of the traits turns out to be completely counter to the way it usually works.