• 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

Count of one type of model may not exceed that of other type

robartes

Member
Hi,

I'm currently being stumped by something which I have the sneaky suspicion is extremely easy, so I'm probably missing something obvious.

Anyway, what I'm trying to do is writing a validation rule (roster scope) that checks whether the total model count of one type of model (call them 'Gallic fanatics' :) ) is equal to or less than that of another type (call them 'Gallic warriors').

I've set up two unit scope statcalcs tracking the total model count (test tag expression with the relevant unitid, and Calculate expression @value = count[model] ), and they seem to work individually. If I write a rule testing their value (e.g. only valid if there are 5 fanatics), it works, but if I do this:

Code:
if ( statcalc[gacountfan] <= statcalc[gacountwar] ) then
  @valid = 1
endif

it always reports back as valid.

Am I missing something here?

Thanks!
 
Handling situations like this is outlined in detail within the Authoring Kit documentation. Specifically, see the chapter on Tips & Tricks. There is a topic entitled "Validating that Entities Satisfy Roster Min/Max Limits" that covers this issue. I'm guessing you'll need to use the mechanisms described in the "Merge Rules" section.

-Rob

At 12:33 PM 12/14/2005, you wrote:

Hi,

I'm currently being stumped by something which I have the sneaky suspicion is extremely easy, so I'm probably missing something obvious.

Anyway, what I'm trying to do is writing a validation rule (roster scope) that checks whether the total model count of one type of model (call them 'Gallic fanatics'
icon_smile.gif
) is equal to or less than that of another type (call them 'Gallic warriors').

I've set up two unit scope statcalcs tracking the total model count (test tag expression with the relevant unitid, and Calculate expression @value = count[model] ), and they seem to work individually. If I write a rule testing their value (e.g. only valid if there are 5 fanatics), it works, but if I do this:

Code:
if ( statcalc[gacountfan] <= statcalc[gacountwar] ) then
  @valid = 1
endif


it always reports back as valid.

Am I missing something here?

Thanks!
 
Re: Count of one type of model may not exceed that of other

rob said:
Handling situations like this is outlined in detail within the Authoring Kit documentation. Specifically, see the chapter on Tips & Tricks. There is a topic entitled "Validating that Entities Satisfy Roster Min/Max Limits" that covers this issue. I'm guessing you'll need to use the mechanisms described in the "Merge Rules" section.

Ah - thanks! I had looked in the tips and tricks section, but had focused on the topic on 'Inter-unit and inter-model dependencies'. I'll have a look at the one you've mentioned.

CU

Bart
 
FWIW, I found the problem that stumped me - it was in the way the statcalcs were set up. I had followed the following guideline from the docs, in the 'Inter-Unit and Inter-Model Dependencies' section:

One way of solving this would be to utilize a hidden roster statistic to calculate the total model count of a unit. If each model count was tallied into a separate roster statistic, you could then write a rule that compared the values of the two roster statistics. To calculate the model count for UnitX, we could assign UnitX its "identity" tag and define our roster statistic with the Test tag expression of "unitid.UnitX". We would not need a Tally script for the roster statistic, and the RosterStat script would simply need to save the automatically tallied model count, as shown below.
Code:
@value = count[model]

Unfortunately, doing that (putting the @value=count[model] in the RosterStat script, which is called Calculate Expression in ABCreator, BTW), results in the statcalc tracking the model count for the *entire roster*. Hence, in my script I was comparing the entire model count with itself, which is of course always true (for a <= comparison).

The correct way (or at least one that works) of doing this, is to leave the Calculate Expression empty, put putting in the following Tally Script:

Code:
@value = @value + count[model]

Perhaps something to take along with the next documentation update ;-)?
 
Duly noted. This is definitely a bug in the docs. It will be fixed within V3.1a.

Sorry about that,
Rob

At 12:20 PM 12/15/2005, you wrote:

FWIW, I found the problem that stumped me - it was in the way the statcalcs were set up. I had followed the following guideline from the docs, in the 'Inter-Unit and Inter-Model Dependencies' section:

Quote:

One way of solving this would be to utilize a hidden roster statistic to calculate the total model count of a unit. If each model count was tallied into a separate roster statistic, you could then write a rule that compared the values of the two roster statistics. To calculate the model count for UnitX, we could assign UnitX its "identity" tag and define our roster statistic with the Test tag expression of "unitid.UnitX". We would not need a Tally script for the roster statistic, and the RosterStat script would simply need to save the automatically tallied model count, as shown below.
Code:

@value = count[model]



Unfortunately, doing that (putting the @value=count[model] in the RosterStat script, which is called Calculate Expression in ABCreator, BTW), results in the statcalc tracking the model count for the *entire roster*. Hence, in my script I was comparing the entire model count with itself, which is of course always true (for a <= comparison).

The correct way (or at least one that works) of doing this, is to leave the Calculate Expression empty, put putting in the following Tally Script:

Code:

@value = @value + count[model]


Perhaps something to take along with the next documentation update
icon_wink.gif
?
 
Back
Top