Senior Member
Volunteer Data File Author
Join Date: Oct 2011
Posts: 121
|
Forgive me if there is an obvious or standard solution to this that I've missed, but here is my situation and question:
I have one category of items for my units that all units have a default limit of 1 of (enforced by exclusion groups and appropriate tags). There is another item that can be taken by some units that raises this limit to 2 but carries the restriction that if they take 2 items from that category they must be different items. The first part is easy (raising the limit) as the exclusion group is tied to a hidden stat and I can just add 1 to the stat. The second part is what I'm having trouble with. I've explored different ways of trying to enforce different items being taken but they seem too unwieldy or very brute force (and therefore hard to maintain as the list of items in that category grows). Any ideas or suggestions would be appreciated. Thanks, ~Antares My code doesn't have bugs; it has undocumented features! |
#1 |
Senior Member
Volunteer Data File Author
Join Date: Oct 2011
Posts: 121
|
Forgot to put this in. The "best" solution I've come up with so far is to have a unit level rule that checks to see if the count of any of the tags for the items in this group is greater than 1. It works, but is brute force, like I said. I have the rule automatically validate and exit if the item that raises the limit to 2 is not present, as best practices would dictate.
My problem with this is that every time a new item is added to the group, I have to add another tag count check to this rule. My code doesn't have bugs; it has undocumented features! |
#2 |
Senior Member
Volunteer Data File Author
Join Date: Oct 2011
Posts: 121
|
Oh this reminds me, does the scripting in Army Builder use short-circuit evaluation, in general, and, in specific, within if statements (e.g. if there are a string of options or'd together does it stop once one of them is true or does it continue evaluating them all anyway even though the boolean expression has a known answer already by definition)?
This would affect the way I write the script i mentioned above as my current "best" solution to this problem. My code doesn't have bugs; it has undocumented features! |
#3 |
Senior Member
Volunteer Data File Author
Join Date: Apr 2005
Posts: 220
|
Quote:
Use 'done' I believe that will kick the execution out of the current if block to the next outer block. The Butcher Warmachine/Hordes ('Retired' Confrontation and AT-43) Army Builder Author. Magic the Gathering Card Vault Author. |
|
#4 |
|
|