Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Army Builder Forums > Army Builder
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
rkajdi
Junior Member
 
Join Date: Dec 2005
Posts: 8

Old May 19th, 2006, 03:27 PM
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
rkajdi is offline   #1 Reply With Quote
harkan
Senior Member
Volunteer Data File Author
 
Join Date: Mar 2005
Posts: 345

Old May 19th, 2006, 09:47 PM
Quote:
if (entity.option[mac5Ag].selection = 1) then
entity.assign[machelp.Agema]
endif
assign returns an integer to see if it was successful or not so you have to assign that to a variable, i.e.

if (entity.option[mac5Ag].selection = 1) then

var retval as number
retval = entity.assign[machelp.Agema]
endif

that should fix that one

Quote:
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.
Depending on how complex the requirement is there are a couple of ways to do it, if it is only counting one tag assigned to a unit with no other criteria (assume the tag expressions are[list.countMe1] and[list.countMe2])

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
harkan is offline   #2 Reply With Quote
rob
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 8,232

Old May 20th, 2006, 01:51 PM
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:
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
rob is offline   #3 Reply With Quote
rkajdi
Junior Member
 
Join Date: Dec 2005
Posts: 8

Old May 21st, 2006, 05:52 AM
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
rkajdi is offline   #4 Reply With Quote
rob
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 8,232

Old May 21st, 2006, 12:34 PM
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:
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
rob is offline   #5 Reply With Quote
rkajdi
Junior Member
 
Join Date: Dec 2005
Posts: 8

Old May 21st, 2006, 04:02 PM
Thanks for the support Rob. I'll take a look at the docs to see if that can helps me with these problems.

Raymond
rkajdi is offline   #6 Reply With Quote
rob
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 8,232

Old May 21st, 2006, 06:18 PM
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:
Thanks for the support Rob. I;ll take a look at the docs to see if that can helps me with these problems.

Raymond
rob is offline   #7 Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 06:10 AM.


Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.