|
|
Thread Tools | Display Modes |
Junior Member
Join Date: Jul 2008
Posts: 10
|
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. |
#1 |
Senior Member
Volunteer Data File Author
Join Date: May 2005
Location: Grenoble, France
Posts: 167
|
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 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 |
|
#2 |
Junior Member
Join Date: Jul 2008
Posts: 10
|
Quote:
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? |
|
#3 |
Senior Member
Volunteer Data File Author
Join Date: May 2005
Location: Grenoble, France
Posts: 167
|
Hello,
&! means "AND NOT" The operators supported are outlined below. Quote:
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 |
|
#4 |
Junior Member
Join Date: Jul 2008
Posts: 10
|
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! |
#5 |
Junior Member
Join Date: May 2009
Posts: 10
|
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. |
#6 |
|
|