MatSum and attachment trait

In v3.6 I made a game with on map leaders, off board leader mats and combat units (regiments and divisions) on the leader mats.

The card board version requires a frequent counting which we solved with the Mats.
Each combat unit has an SP value.
Each mat has an SP which was the sum off all the units on a mat with its matID.
The onboard leader had an SP which was taken from the Mat with a matching name.
Updates were propagated by global key commands.
It was a bit clunky but it worked! (as long as you did not put a leader on its own mat.)

Anyways with v3.7 we have a MatSum() method and a attachment trait.
Matsum() should simplify the mat summing.
The attachment trait should simplify linking the onboard leader to its off board mat.
And I expect that the whole module will run a lot more smoothly.

However I just can’t get the matsum to work. (Haven’t even tried the trait yet)
Should Mat and MatCargo be above or below the dynamic SP property.
In my mind I can argue it either way.
I tried both but neither works.

A related question:
When you are editing a module, do you need to exit the editor to try out your changes?

SumMat(), right? Was that just a typo in your post?

Restarts generally not required but there are exceptions, especially if you’ve changed anything to do with maps, the order of mouseovers, touched the game piece layers component (all pieces disappear, unhelpfully) or perhaps the order of buttons. Also if you examine a Global Property, it will get re-initialised.

If you are working on an existing scenario, rather than setting up a fresh game each time, then you will need to do a Refresh (see Tools menu).

Mark

Thanks Mark

Indeed it is SumMat. It has the green tick of approval in the expression box.

What should be the right trait order for Mat and and an expression using mat or mat cargo.

Cheers
Gus

You can read about Trait Ordering in the reference manual here. Checking out Mat Cargo and Mat in the advanced list there, I do not think that is your issue - the only interaction seems to be with Mat Cargo for drawing purposes.

It may help if you share the key traits and calculations that you are trying to make work. I notice that you mention Attachments. Vassal provides SumAttachment() as well if that helps. For 1-1 attachment relationships, reading a property between the attached pieces is even easier; simply reference the remote property in the form <Attachment>_<PropertyName>.

Thanks I’ll give it another go on the weekend. I had a look at the alomorovid module and saw that the mats all had names.

Rather than retrofit the existing counters I’ll reduce it to something simple.