Create account / Log in

V3.4 & general: A thought on map/zone parameter in functions

Issues with the Vassal engine.

Moderators: uckelman, Tim M

V3.4 & general: A thought on map/zone parameter in functions

Postby marktb1961 » October 2nd, 2020, 12:21 pm

I notice that new functions such as Count() have two forms. For example,

Count(expr) - counts across all maps
Count(expr, map ) - counts on specified map

Perhaps, this is a general format already too well established in Vassal to go against, but it occurs to me that it would be more safe for module performance in general and flexibility of use, if the default [e.g. Count(expr)] was just to operate on the current map. And (perhaps this already works, I have not tried), if the fully qualified version would accept a regular expression that would be pattern-matched against all maps (assuming that it contained a wild-card specification).

Just an idea...

PS Count() in particular is proving very handy to me and I am finding performance very acceptable. In my application so far, I am able to limit the target pieces by area (e.g. Location and Zone) and I guess this helps.
Platform: Vassal 3.4.11, MacOS Big Sur on iMac (27", mid-2020)
User avatar
marktb1961
 
Posts: 346
Joined: October 4th, 2018, 2:36 pm
Location: Liverpool, England

Re: V3.4 & general: A thought on map/zone parameter in funct

Postby kerkael » November 16th, 2020, 2:59 pm

Indeed, the combination is quite good, if you work with multiple maps and identically named zones on them.

I have different colored labs (as named maps), each of which has 2 or more named zones :
Code: Select all
Count("{CurrentZone==\"Base Elements\"}","Red Lab")

This could also be used with another trait, like a marker nature=="base element"

My guess is that this won't take as many system resources to count from a specific map as from the whole module.
Module I developed: Terraforming Mars
Module I'm working on: Trismegistus
kerkael
 
Posts: 179
Joined: December 1st, 2017, 3:03 pm


Return to Technical Support & Bugs

Who is online

Users browsing this forum: No registered users and 2 guests