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
veritechc
Junior Member
 
Join Date: Jul 2008
Posts: 10

Old February 9th, 2012, 08:20 AM
In Firestorm Armada If you take Heavy Cruisers there are some rules to follow.

Heavy Cruisers are medium ships.

No more than half of your medium ships can be Heavy Cruisers

So I set up a validation rule as follows:

In Firestorm.def I added a rule called hvcruiserv.

In turn that is inherited by my ruleset Tournament.

In validation.dat, under rule I made a rule called cahvalidat and linked that to hvcruiserv under rulesets.

It uses the script:

if (tally[unit:size.M] > tally[unit:type.CAH]) then
@valid = 1
endif

Unfortunately it is not doing what I want. What I need it to do is look at the roster, total the number of medium ships (size.M) and compare that against the number of heavy cruisers (type.CAH) only. I also need it to evaluate the number of Heavy Cruisers and medium per model added no matter where on the roster.

What am I doing wrong?

The data files can be downloaded here: http://www.theblackocean.com/resourc...estormtest.zip

Thank you again for all your help.
veritechc is offline   #1 Reply With Quote
Garfunkel
Senior Member
Volunteer Data File Author
 
Join Date: May 2005
Location: Grenoble, France
Posts: 167

Old February 10th, 2012, 03:25 AM
Hello,

I don't know the right behaviour you need :
Is it the number of models, or units ?

For models, you can use the script:
Quote:
if (tally[model:size.M&!type.CAH] > tally[model:type.CAH]) then
@valid = 1
else
if (tally[model:type.CAH] =0) then
@valid = 1
endif
endif
It seems it works.
If it is units number to be compare, just replace the model term with unit.
I added a test in case there is no superheavy. (When the roster is empty for example)

What you misses is that your heavy cruisers also have the tag size.M.
The real test is you need more ship with size.M AND NOT type.CAH than type.CAH ships.

I advise you to show size and type on the available list profil instead of simply display it on the info. It is easyer to fulfill the rule when the discriminating type is displayed for the whole range of ship. (Instead of just one on the info) And use the same terms on the rule message than what is displayed (S or Small, M or Medium, Heavy Cruiser or CAH) or add the abbreviation in the rule message.

Hope that helps,

Garfunkel
Garfunkel is offline   #2 Reply With Quote
veritechc
Junior Member
 
Join Date: Jul 2008
Posts: 10

Old February 13th, 2012, 11:38 AM
Quote:
Originally Posted by Garfunkel View Post
Hello,

I don't know the right behaviour you need :
Is it the number of models, or units ?

For models, you can use the script:

It seems it works.
If it is units number to be compare, just replace the model term with unit.
I added a test in case there is no superheavy. (When the roster is empty for example)

What you misses is that your heavy cruisers also have the tag size.M.
The real test is you need more ship with size.M AND NOT type.CAH than type.CAH ships.

I advise you to show size and type on the available list profil instead of simply display it on the info. It is easyer to fulfill the rule when the discriminating type is displayed for the whole range of ship. (Instead of just one on the info) And use the same terms on the rule message than what is displayed (S or Small, M or Medium, Heavy Cruiser or CAH) or add the abbreviation in the rule message.

Hope that helps,

Garfunkel
Thank you so much. It worked like a charm. I owe you one Garfunkel.

I actually do understand why this worked and your thought on adding a validation for no Heavy Cruisers in the same expression was great.

So now to understand what I don't know.

if (tally[model:size.M&!type.CAH] > tally[model:type.CAH]) then
@valid = 1

What does the "&!" do? Where are those expressions listed?
veritechc is offline   #3 Reply With Quote
Garfunkel
Senior Member
Volunteer Data File Author
 
Join Date: May 2005
Location: Grenoble, France
Posts: 167

Old February 14th, 2012, 07:29 AM
Hello,

&! means "AND NOT"

The operators supported are outlined below.

Quote:
& Logical “And”. Evaluates the two terms on either side and returns “true” only if both terms are “true”. Example: “term1 & term2”.

| Logical “Or”. Evaluates the two terms on either side and returns “true” if either of the terms is “true”. Example: “term1 | term2”.

^ Logical “Xor”. Evaluates the two terms on either side and returns “true” if exactly one of the terms is “true”. Example: “term1 ^ term2”.

! Logical “Not”. Evaluates the following term and returns “true” if that term is “false”. Otherwise, it returns “false”. Example: “!term1”.
I suppose you already know the documentation main entry point:C:\Program Files\Army Builder\docs\kit\ab_kit.htm
It is very extensive, but if you need to concentrate on a specific subject, it is very usefull and makes you use the full power of the engine.

It is still OK to ask.
I did devellop a lots of such scripts just for fun and I know how valuable it is to get some help and I like to discuss on the behaviors others may need to program. It gives me ideas for my owns.


Regards,
Garfunkel
Garfunkel is offline   #4 Reply With Quote
veritechc
Junior Member
 
Join Date: Jul 2008
Posts: 10

Old February 15th, 2012, 06:50 AM
Thank you again. I have read and reread that section to no avail. It gives me that same sinking feeling I had the first time I started begging French, lol. By the way I never got the hang of French...

My problem seems to stem from not thinking like a programmer in the first place. I am hoping that eventually it will just click.

I can tell you that I will be thanking you officially on our podcast. You can find out about us at www.theblackocean.com. The next episode should be out next week sometime.

Thanks!
veritechc is offline   #5 Reply With Quote
paladin2019
Junior Member
 
Join Date: May 2009
Posts: 10

Old February 16th, 2012, 01:28 PM
Additional issue on heavy cruisers.

You cannot reduce the base size of a cruiser squadron to 1 to create a 2 ship squadron of 1 cruiser and 1 heavy cruiser.
paladin2019 is offline   #6 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 09:12 AM.


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