Create account / Log in

How to add two values

Topics related to the main Vassal engine.

Moderators: uckelman, Tim M

How to add two values

Postby flashsolutions » December 4th, 2016, 2:09 pm

I am building a typical 52 deck card game in which I need to assign numeric values to each of the cards. 9 of these cards will end up being shown on a map game board.

At the completion of the game, I need to be able to add the point values for a total score. I also need to be able to check the positions of each card to determine their order and alter the values of the cards if the order matches the criteria I am looking for.

I have defined a Deck to hold the 52 cards and included a Marker named "PointValue" with a unique value for each card.

For testing purposes, I added a Report Action button to display the value of the card and attempted to add an arbitrary value to it at runtime, but it does not produce the desired results.

The button action is $location$: $newPieceName$: {$PointValue$+30} and simply displays "* Hole 1: 10_Hearts: {10+30}" when executed. The $PointValue$ is displayed as the correct value, but I wanted to see the value of 30 added to it for a result of 40.

What do I need to do to get the addition to work and what would be the syntax to check the value of card to determine the value I wish to add together with the cards point value? Ultimately, I wish to have a button that can be activated from the main menu to go thru the 9 card values to determine their positions and score accordingly.

Is there a better way to accomplish what I am trying to do?
flashsolutions
 
Posts: 8
Joined: August 25th, 2013, 5:59 pm

Re: How to add two values

Postby flashsolutions » December 5th, 2016, 8:40 pm

Found the answer. Had to use a Calculated Property instead of doing the calculation in the report message.
flashsolutions
 
Posts: 8
Joined: August 25th, 2013, 5:59 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests