# Change-Property Toolbar getting sloppy

**URL:** <https://forum.vassalengine.org/t/change-property-toolbar-getting-sloppy/90444>\
**Category:** Module Design\
**Created:** [August 18, 2026, 4:15pm UTC](https://forum.vassalengine.org/t/change-property-toolbar-getting-sloppy/90444 "2026-08-18T16:15:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthias\_Hardel](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@Matthias\_Hardel](https://forum.vassalengine.org/u/Matthias_Hardel)\
**Post date:** [August 18, 2026, 4:15pm UTC](https://forum.vassalengine.org/t/change-property-toolbar-getting-sloppy/90444/1 "2026-08-18T16:15:28Z")

</div>

Having made a simple dice roller statistic report using three Global Properties and the Hotkeys for the Change-Property Toolbars, it worked fine. For a while.

This is how the report on the hotkeys looks like

\* Soviet CRT roll number 1 = 10  
\* added to Soviet CRT roll total = 10  
\* Soviet CRT roll average = 10

After a few rolls the third report gets missing from time to time and then all together.

\* Soviet CRT roll number 4 = 6  
\* added to Soviet CRT roll total = 22

\* Soviet CRT roll number 5 = 8  
\* added to Soviet CRT roll total = 30  
\* Soviet CRT roll average = 6

\* Soviet CRT roll number 6 = 6  
\* added to Soviet CRT roll total = 36

\* Soviet CRT roll number 7 = 3  
\* added to Soviet CRT roll total = 39  
\* Soviet CRT roll average = 5

\* Soviet CRT roll number 8 = 8  
\* added to Soviet CRT roll total = 47

\* Soviet CRT roll number 9 = 6  
\* added to Soviet CRT roll total = 53

\* Soviet CRT roll number 10 = 1  
\* added to Soviet CRT roll total = 54

The number rolled is added to a GP, and this GP value is divided by the number of rolls (a second GP) to calculate the average (the third GP).

Here is a link to a tiny example module showing the strange behavior:

> **[DieRollStatisticsTest\_0.1.vmod](https://wetransfer.com/downloads/29480d9056e7898583df92a103c4599220260818142724/697bc5?t_exp=1787322445&t_lsid=50019e53-8c6d-4b90-90b4-183e7c6094ac&t_network=link&t_rid=ZW1haWx8YWRyb2l0fGUyNjYwMjM3LWU0MjYtNGE5Mi05MmY5LTEyMDY3MjVkNGY4ZQ==&t_s=download_link&t_ts=1787063245)**
>
> 1 file sent via WeTransfer, the simplest way to send your files around the world

Any help is welcome.

---

<div class="post-metadata">

**Author:** ![cholmcc](https://forum.vassalengine.org/user_avatar/forum.vassalengine.org/cholmcc/32/8319_2.png) [@cholmcc](https://forum.vassalengine.org/u/cholmcc)\
**Post date:** [August 18, 2026, 6:51pm UTC](https://forum.vassalengine.org/t/change-property-toolbar-getting-sloppy/90444/2 "2026-08-18T18:51:52Z")

</div>

The reason you see no print-out of the new average is because the value stored in that Global Property didn’t change. Hence, there were no change, and therefor there’s no report of the change.

Also, you should probably cast your sum to a `float` when you do the division by number of observations, so that you get a decimal average. If you sum property is called `Sum` and your count property is called `N`, then the calculation of the average property (say `Average`) value should be

```auto
{((float)Sum) / N}

```

When you print it out, you may want to round it to some number of digits after the decimal point. For example

```auto
{Math.round(Average * 100) / 100}

```

How many decimal points to round to really depends on the _uncertainty_ on the mean, which is given by √(Variance/N). The variance is given by 1/(N-1)Σ (x\_i - Average)^2. The _uncertainty_ should be quoted with _one_ significant digit, and the value - the average - should be given to the same precision.

In fact, it doesn’t really make sense to report the average without also quoting the spread, given by √(Variance). The mean only tells you what the user’s expectation value is, not how widely it is distributed. Thus, you should really also calculate the variance and quote the spread.

Normally, one can only calculate the variance _after_ the mean as been measured, _and_ one must have the _full_ set of observations to do so. That is impractical in Vassal. However, there is a way to calculate a running value of the variance. For the first observation _x_, we set

- _Average_ = _x_
- _Variance_ = 0
- _N_ = 1

For subsequent observations _x_, we set

- _OldAverage_ = _Average_
- _OldVariance_ = _Variance_
- _OldN_ = _N_
- _N_ = _OldN_ + 1
- _Average_ = _OldAverage_ + 1 / _N_ \* (_x_ - OldAverage)
- _Variance_ = (_N_ - 2) / (_N_ - 1) \* OldVariance + 1 / (_N_ - 1) \* (_x_ - _OldAverage_) \* (_x_ - _Average_)

(see also [Wikipedia](https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Welford's_online_algorithm)).

If the variance differs significantly from the expected variance, then there’s cause to think that the distribution isn’t perhaps the expected distribution. One cannot use the mean to draw such a conclusion.

Yours,  
_Christian_

---

<div class="post-metadata">

**Author:** ![Matthias\_Hardel](https://forum.vassalengine.org/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@Matthias\_Hardel](https://forum.vassalengine.org/u/Matthias_Hardel)\
**Post date:** [August 19, 2026, 7:18am UTC](https://forum.vassalengine.org/t/change-property-toolbar-getting-sloppy/90444/3 "2026-08-19T07:18:53Z")

</div>

Many thanks, Christian,

that solved the “mystery.” And as a side effect, it helped to employ the result properly as float.
