EvalRule Element (Data)
The "evalrule" Element
Throughout your data files, you'll want to verify facets of different picks within actors. This is accomplished by writing rule scripts on components and things for execution during the evaluation cycle. These rule scripts are referred to as EvalRule scripts, or often simply as "eval rules", and are invoked on each individual pick within the actor. Each separate rule is specified through the use of an "evalrule" element. The complete list of attributes for this element is below.
NOTE! For more information on many of these attributes, please see Advanced Script Handling.
phase Id – Specifies the unique id of the evaluation phase during which the rule is invoked. priority Integer – Specifies the evaluation priority during which the rule is invoked. message Text – Specifies the error message displayed to the user within the validation report when the rule is not satisfied. summary (Optional) Text – Specifies the summary message displayed within the validation summary bar at the bottom of the main window when the rule is not satisfied. If empty, the message is used as the summary. Default: Empty. index (Optional) Integer – Assigns an arbitrary, but unique, value to this rule. This index is used within error messages to identify the rule where the problem occurs. If the rule is assigned a name (below), no index is necessary. Default: "1". severity (Optional) Set – Identifies the severity level associated with failing the rule. Must be one of these values:
- error - The rule indicates a serious error within the character
- warning - The rule indicates a non-critical warning within the character
- Default: "error".
runlimit (Optional) Integer – Specifies the maximum number of times this rule will be invoked during the evaluation cycle for each container. A value of zero indicates no limit. Default: "0".
NOTE! The limit is imposed separately within each container, so the rule will always be invoked for picks within different containers.
iseach (Optional) Boolean – Indicates whether the "runlimit" applies individually to each thing or collectively to all things derived from the component. This attribute is only applicable component scripts. Default: "yes". reportlimit (Optional) Integer – Specifies the maximum number of times the message for this rule will be reported during the evaluation cycle for each container. A value of zero indicates no limit. Default: "0".
NOTE! The limit is imposed separately within each container, so failures of the rule will always be reported for picks within different containers.
issilent (Optional) Boolean – Indicates whether the rule should report an error message to the user if failed. In some cases, you'll simply want to properly highlight picks as invalid within the interface without reporting individual errors. In such cases, you can have the rule test all picks and mark them as invalid, but suppress any actual message. Default: "no". sortas (Optional) Id – Specifies the unique id of a different component for which the rule will be sorted when establishing the task evaluation sequence. This attribute is only applicable to component rules. If empty, the rule uses the sequencing for the component it is defined within. Default: Empty. name (Optional) Text – Specifies the name assigned to this rule for the purpose of establishing timing dependencies. If empty, no timing dependencies may be defined elsewhere that depend upon this rule. Default: Empty. isprimary (Optional) Boolean – Indicates whether this task should be considered the "primary" task when multiple tasks are assigned the same name. Default: "no". PCDATA Script – Specifies the code comprising the EvalRule script.
The "evalrule" element also possesses child elements that pertain to the handling of the rule. The list of these child elements is below and must appear in the order shown. Click on the link to access the details for each element.
match An optional "match" element may appear as defined by the given link. This element defines a Match Tag Expression that must be satisfied in order for the rule to be assigned to each thing. If omitted, the rule is applied to all derived things.
IMPORTANT! This element is only applicable when the condition test is defined within a component. In all other cases, this element may not be specified.
before Zero or more "before" elements may appear as defined by the given link. This element specifies appropriate timing dependencies possessed by the rule. after Zero or more "after" elements may appear as defined by the given link. This element specifies appropriate timing dependencies possessed by the rule.
The "match" Element
The "match" element defines the Match tag expression that determines whether a particular thing is assigned the eval rule. The tag expression is applied against each thing derived from the component, and the rule is only assigned to things that satisfy the tag expression. The complete list of attributes for this element is below.
PCDATA TagExpr – Specifies the code comprising the Match tag expression.
The following example demonstrates what an "evalrule" element might look like. All default values are assumed for optional attributes.
<evalrule index="1" phase="Setup" priority="500" message="Rule Failed"> <before name="BeforeTest"/> <after name="AfterTest"/> @valid = 1 </evalrule>