Difference between revisions of "Category:Conditions"

Jump to navigation Jump to search
74 bytes added ,  20:38, 17 September 2013
m
imported>Egocarib
(Added notes on "Complex Conditions")
imported>Egocarib
Line 69: Line 69:




By applying the distributive property and taking other logical considerations, complex expressions can be converted into a list of Condition Items that will evaluate as intended. For example, the expression (('''''A''''' AND '''''B''''') OR ('''''C''''' AND '''''D''''')) can be represented by the logically equivalent list of Condition Items ('''''A''''' OR '''''C''''' AND '''''B''''' OR '''''C''''' AND '''''A''''' OR '''''D''''' AND '''''B''''' OR '''''D'''''). As described above, operator precedence will result in this being evaluated as (('''''A''''' OR '''''C''''') AND ('''''B''''' OR '''''C''''') AND ('''''A''''' OR '''''D''''') AND ('''''B''''' OR '''''D''''')) which is equivalent to the initial expression.
By applying the distributive property and taking other logical considerations, complex expressions can be converted into a list of Condition Items that will evaluate as intended.


<br>For example, the expression
*(('''''A''''' AND '''''B''''') OR ('''''C''''' AND '''''D'''''))<br>
Can be represented by the logically equivalent list of Condition Items
*('''''A''''' OR '''''C''''' AND '''''B''''' OR '''''C''''' AND '''''A''''' OR '''''D''''' AND '''''B''''' OR '''''D''''').<br>
As described above, operator precedence will result in this being evaluated as
*(('''''A''''' OR '''''C''''') AND ('''''B''''' OR '''''C''''') AND ('''''A''''' OR '''''D''''') AND ('''''B''''' OR '''''D'''''))&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;&nbsp;which is equivalent to the initial expression.


*To properly check whether (('''''A''''' AND '''''B''''') OR ('''''C''''' AND '''''D''''') OR ('''''E''''' AND '''''F''''')) is true, one would use:
 
**'''''A''''' OR '''''C''''' OR '''''E'''''  &nbsp;&nbsp;AND&nbsp;&nbsp;  '''''A''''' OR '''''C''''' OR '''''F'''''  &nbsp;&nbsp;AND&nbsp;&nbsp;  '''''A''''' OR '''''D''''' OR '''''E'''''  &nbsp;&nbsp;AND&nbsp;&nbsp;  '''''A''''' OR '''''D''''' OR '''''F'''''  &nbsp;&nbsp;AND&nbsp;&nbsp;  '''''B''''' OR '''''C''''' OR '''''E'''''  &nbsp;&nbsp;AND&nbsp;&nbsp;  '''''B''''' OR '''''C''''' OR '''''F'''''  &nbsp;&nbsp;AND&nbsp;&nbsp;  '''''B''''' OR '''''D''''' OR '''''E'''''  &nbsp;&nbsp;AND&nbsp;&nbsp;  '''''B''''' OR '''''D''''' OR '''''F'''''
<br>To properly check whether (('''''A''''' AND '''''B''''') OR ('''''C''''' AND '''''D''''') OR ('''''E''''' AND '''''F''''')) is true, one would use:
*'''''A''''' OR '''''C''''' OR '''''E'''''  &nbsp;&nbsp;AND&nbsp;&nbsp;  '''''A''''' OR '''''C''''' OR '''''F'''''  &nbsp;&nbsp;AND&nbsp;&nbsp;  '''''A''''' OR '''''D''''' OR '''''E'''''  &nbsp;&nbsp;AND&nbsp;&nbsp;  '''''A''''' OR '''''D''''' OR '''''F'''''  &nbsp;&nbsp;AND&nbsp;&nbsp;  '''''B''''' OR '''''C''''' OR '''''E'''''  &nbsp;&nbsp;AND&nbsp;&nbsp;  '''''B''''' OR '''''C''''' OR '''''F'''''  &nbsp;&nbsp;AND&nbsp;&nbsp;  '''''B''''' OR '''''D''''' OR '''''E'''''  &nbsp;&nbsp;AND&nbsp;&nbsp;  '''''B''''' OR '''''D''''' OR '''''F'''''




Line 87: Line 94:


'''IMPORTANT:'''
'''IMPORTANT:'''
Keep in mind that when attaching conditions to "high-demand" items, like spells and magic effects, using too many conditions can result in a major hit to performance, and should be avoided. Checking whether one AND-pair is true in a set of more than three such pairs (beyond what is shown above) will quickly and exponentially increase the number of conditions that would have to be checked if distributed to account for OR-precedence. Try to find alternative methods if possible--like checking the necessary conditions in a script that can evaluate them more quickly and efficiently.
Keep in mind that when attaching conditions to "high-demand" items, like spells and magic effects, using too many conditions can result in a major hit to performance, and should be avoided. Checking whether one AND-pair is true in a set of more than three such pairs (beyond what is shown above) will quickly and exponentially increase the number of conditions that would have to be checked if distributed to account for OR-precedence. Try to find alternative methods if possible--like checking the necessary conditions in a script that can evaluate them more quickly and efficiently.<br><br>






[[Category:Quests]]
[[Category:Quests]]
Anonymous user

Navigation menu