PreReq Element (Data)
Context: HL Kit … Kit Reference … Multiple Sources
The "prereq" Element
You can establish dependencies wherein certain things require specific conditions to be satisfied by their prospective container in order to be added. These conditions are referred to as Pre-Requisites and are always tested against the prospective container for a thing. Each pre-requisite is specified through the use of a "prereq" element. The complete list of attributes for this element is below.
message Text – Specifies the error message displayed to the user within the validation report when the pre-requisite is not satisfied. iserror (Optional) Boolean – Indicates whether the failing the pre-requisite is considered to an error or merely a warning. This only applies if the user chooses to ignore a failed pre-requisite and add the thing to the container anyways. Default: "yes". onlyonce (Optional) Boolean – Indicates whether the pre-requisite should only be reported to the user a single time if it fails. This is important for situations where the pre-requisite is assigned to a thing that is added to a container multiple times, such as class levels within the d20 System. This attribute is only applicable to pre-requisites specified directly on individual things. Default: "no". issilent (Optional) Boolean – Indicates whether the pre-requisite 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 pre-requisite perform its tests and mark picks as invalid, but suppress any actual message. Default: "no".
The "prereq" element also possesses child elements that pertain to the handling of the requirement. 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 pre-requisite to be assigned to each thing. If omitted, the pre-requisite is applied to all derived things. IMPORTANT! This element is only applicable when the pre-requisite is defined within a component. In all other cases, this element may not be specified.
test An optional "test" element may appear as defined by the given link. This element defines a Container Tag Expression that determines whether the pre-requisite is satisfied. If omitted, the pre-requisite is assumed to satisfy this test. validate An optional "valid" element may appear as defined by the given link. This element defines a Validate Script that determines whether the pre-requisite is satisfied. If omitted, the pre-requisite is assumed to satisfy this test.
The "match" Element
The "match" element defines the Match tag expression that determines whether a particular thing is assigned the pre-requisite. The tag expression is applied against each thing derived from the component, and the pre-requisite 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 "test" Element
The "test" element defines the Container tag expression that determines whether the pre-requisite is satisfied. The tag expression is applied against all the tags of the container, and the pre-requisite is considered valid if the tag expression is satisfied. The complete list of attributes for this element is below.
PCDATA TagExpr – Specifies the code comprising the Container tag expression.
The "validate" Element
The "validate" element defines the Validate script that determines whether the pre-requisite is satisfied. The script is applied against the container, and the pre-requisite is considered valid if the script reports the container as valid. The complete list of attributes for this element is below.
PCDATA Script – Specifies the code comprising the Validate script.
Example
The following example demonstrates what an "prereq" element might look like. All default values are assumed for optional attributes.
<prereq message="Requirement Failed."> <valid> @valid = 1 </valid> </prereq>