[messages] [Module Design] Action button modifying global property

Jym jean-yves.moyen at ens-lyon.org
Fri May 23 23:49:03 CEST 2014

So, I have a global property -say "Foo"- and I need a global action
button on the toolbar that changes it.

The way I am doing it currently is:
* create a counter with a marker trait "foo_controller = true"
* add a "Set global property" trait to that counter in order to modify
my global property, eg "incrementFoo" does +1 to Foo.
* add extra layers of protection to that counter (invisible, does not
stack, cannot be moved, undeletable, …) so that players don't
accidentally screw it.
* create a "global key command" button that send "incrementFoo" to all
counters with "foo_controller = true".

That does work but it seems a bit too complicated. I'm not sure why I
need to create a local thing (counter) in order to modify global stuff.
Moreover, I need to heavily protect the counter as accidentally deleting
it would ruin everything (and having a second one would also be bad).
And from a computational point of view, since the "matching property"
test of the global key command may depend on Dynamic properties, I guess
that every time I click the button, Vassal has to go through all the
game pieces to find the proper ones. That obviously takes way more time
than needed to perform the task (ie, linear time rather than constant).

So, is there a direct way to have an action button directly modifying a
global property? Or a simpler/more efficient way to do it than what I

Read this topic online here:

More information about the messages mailing list