Junior Member
Join Date: Dec 2005
Posts: 8
|
I've been working on the new version of the WAB files for AB v3.1, and I'm almost complete, but there are a couple of issues I'm having with setting up validation rules. Hopefully someone here ought to be able help me with them so that I can complete these files (at least until the next army book comes out)
1. I am try to figure out how to attach a tag to a unit if a certain option is chosen. I think I'm supposed to use assign[tag], but I can't get it working. My current syntax is: if (entity.option[mac5Ag].selection = 1) then entity.assign[machelp.Agema] endif In the entity's postlink script. All this does is give me a parse error. Any suugestions? 2. How should I should I get a stat calc of the number of tags of a certain type are in an roster? I'm having a hard time getting this done. This is to check for a global "There must be as many Xs as Ys" for the whole army. 3. Finally, I am trying to get an accurate count of the number of models in a child unit in reference to a parent unit. I need to be able to set exact porportions for mixed formation units. Any ideas? Help on any of these three problems would be appreciated, as it would jump start my ability to get everything done for WAB. Raymond K. Crum |
#1 |
Senior Member
Volunteer Data File Author
Join Date: Mar 2005
Posts: 345
|
Quote:
if (entity.option[mac5Ag].selection = 1) then var retval as number retval = entity.assign[machelp.Agema] endif that should fix that one Quote:
Go into statcalc and create a new one (example ID of countMe1) set it to scope: roster set visibility: never in the tally expression enter: @value = tally[unit:list.countMe1] (if the tag is assigned to items n options then u could use after this line: @value = @value + tally[item:list.countMe1] @value = @value + tally[option:list.countMe1] but I am not too sure about those though) create another statcalc the same but for list.countMe2 Then create a rule and within the rule (roster level), use: if (statcalc[countMe1] = statcalc[countMe2]) then @valid = 1 done endif |
||
#2 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 8,232
|
Harkan addressed item #1 completely, so I'll chip in my couple of pennies on the other two....
For #2, Harkan's suggestion of using "tally" is suboptimal. The reason is that using "tally" is extremely expensive in terms of computation. Instead, the trick would be to designated the tags as "accrued". You can then get the totals very easily. This exact topic is covered in pretty good detail within the documentation. Please go to the "Tips & Tricks" chapter and check out the topics "Calculating Ratios in Scripts" and "Inter-Unit and Inter-Model Dependencies". These ought to give you all the basics you need. If you have specific questions after reviewing these two topics, please post them and we'll do our best to provide answers. For #3, I'm not sure what you are exactly going to use the values for, so I can't offer specific suggestions. Please provide me with more details on how the proportion information will be used. Is it intended for validation? Or for some other purpose? If you need to actually use the model count for something special, there are two convenient ways to to have the child inform the parent of its model count. The first method is to define a private unit stat and have the child unit assign its model count to the parent's value for that private unit stat within its PreLinks scripts. The second method is to assign an exclusion reference to the child, with the usage being pulled from the child's model count. Both techniques will provide the count to the parent, although one method will be better than the other depending on how you will actually be using the value. Since you talk about mixed formation units, you should read the topics within the "Tips & Tricks" chapter that refer to "exclusion groups". There are about a half-dozen, and they outline different ways you can leverage exclusions to enforce limits. These approaches can typically be leveraged for ratios, as well, so this might be what you need. Hope this helps, Rob At 04:27 PM 5/19/2006, you wrote: Quote:
|
|
#3 |
Junior Member
Join Date: Dec 2005
Posts: 8
|
For #3, here's the easiest way to explain it. I have an option that spawns a child for an entity. I want to find a way to check to make sure that the child unit is always is in some ratio to the unit that spawned it.
Raymond |
#4 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 8,232
|
Checkout the topic "Adding Customized Child Units Up to a Limit" within the Tips & Tricks chapter of the docs. Then read the topic "Applying Exclusions to Options that Use New Link". Both of these are among the list that I suggested in my last post.
The only difference is that the private unit stat for the parent will not be a fixed value. Instead, it will need to be calculated based on the model count of the parent unit to properly reflect the proper ratio. You can accomplish this easily by defining a calculated unit stat. Hope this helps, Rob At 06:52 AM 5/21/2006, you wrote: Quote:
|
|
#5 |
Junior Member
Join Date: Dec 2005
Posts: 8
|
Thanks for the support Rob. I'll take a look at the docs to see if that can helps me with these problems.
Raymond |
#6 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 8,232
|
If the examples I cited don't apply for some reason, let me know the details about how your situation is different and I'll see what I can come up with for an alternative solution.
-Rob At 05:02 PM 5/21/2006, you wrote: Quote:
|
|
#7 |
|
|