• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Looking for a little scripting help...

ChainsawXIV

Active member
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
 
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
 
Back
Top