Member
Join Date: Oct 2005
Posts: 39
|
I need to count the number of points in a roster from units carrying a specific tag in order to run a validation script, and cant figure out how to make it run. The sample script follows, but I suspect that my problem is that I'm misunderstanding exactly what sort of data is returned by the tagvalue[ ] function. The documentation isn't really clear on what the 'value' is that is returned, and weather matching multiple instances of a tag in this way accumulates the values, or just returns the value for one instance of the tag. If anyone can fill me in on the details, and/or help me back onto the right track, that'd be great. Here's the script:
Code:
var quarter as number quarter = this.roster.activesize / 4 if (tagcount[CharStuff.Ikit] > 0) then if (tagvalue[SkavStuff.ClanSkryre] >= quarter) then @valid = 1 else @valid = 0 endif else @valid = 1 endif |
#1 |
Senior Member
Volunteer Data File Author
Join Date: Mar 2005
Posts: 345
|
try using a statcalc to add up the points in the roster and then use the results of that in the rule. Something similar to:
(statcalc) id - (suggested) clanSkyrePnt scope - unit test expression - SkavStuff.ClanSkryre (am assuming that units with this tag are what you want to count) tally expression - @value = @value + cost[total] (rule) var quarter as number quarter = this.roster.activesize / 4 if (tagcount[CharStuff.Ikit] < 1) then @valid = 1 done endif if (statcalc[clanSkyrePnt] >= quarter) then @valid = 1 endif |
#2 |
Member
Join Date: Oct 2005
Posts: 39
|
Thanks for the assist, I'd never used the statcalc feature before. That worked like a charm.
|
#3 |
|
|