I have 10 points to distribute between 0-6 players depending on how many of their pieces have been placed on certain locations in an area. Say 3 players have an equal number of pieces there, they get 3 points each. This calculation is done for about 20 different areas, with 4-8 locations in each area, so there are lot of possible outcomes.

Do I need to write ? : strings for each location, for each possible combination and outcome? Or is there a more concise way to write the calculation and round down?

Like, here’s a draft example I wrote to calculate just “r’s” score for area 1 with 4 locations, where I first calculated totals 1r, 1b etc. for how many pieces each player has in the area:

This gives me outcomes in rough order of likelihood: 0, 10, 5, 3, 2, 6, 7, and will work, but repeat 6 times for each of 20 locations, and it’s a chore to write out.

Unless I’m not fully understanding what you’re trying to do, Vassal automatically rounds down and throws out remainders unless you get sophisticated with it.

For example, if you have a formula that is x = y/3 than, x will return 3 if y is 9, 10 or 11. It won’t return 4 until y hits 12. In other words, it returns the whole number only and throws out the remainder.

If 1r is not zero, it is supposed to calculate 10 x the ratio of 1r to all 6 of the colours. In practice, it returns 10 when only 1r is positive, but 0 if any other colour is positive. I guess because the ratio is rounded down to 0 before being multiplied by 10? Seems odd. How can I do this the right way?

Are all of those properties guaranteed to have a numeric value? If any of them don’t, the whole thing will end up being treated as a string instead of a number…

Also, I’m not clear on why you’re even using GetProperty, rather than referencing the properties directly…

It shouldn’t make any difference (according to the java order of operations), but have you tried an extra set of parentheses around the “10*1r” bit of the calculation?

Oops. Just looked closer at your formula, and it isn’t working because you already have an extra set of parentheses in there that don’t belong…you’re forcing the division to occur before the multiplication!