Component Element (Data)

From HLKitWiki
Jump to: navigation, search

Context: HL KitKit Reference … Structural File Reference 

The "component" Element

At the heart of every thing are the components that define their shared behaviors. All components define a collection of fields and re-usable behaviors that can be combined into component sets. Each component is specified through the use of a "component" element. The complete list of attributes for this element is below.

id Id – Specifies the unique id of the component. This id is used in all references to the component.
name Text – Public name associated with the component. Maximum length of 50 characters.
sequence (Optional) Set – Designates the default sorting sequence to be used for picks based on this component. If no sort set is specified, or if the sort set does not yield a difference, picks will be sorted based on this criteria. Must be one of these value:
  • ascii – Sort alphabetically based on pick name.
  • nocase – Ignore case while sorting alphabetically.
  • id – Sort on the unique id of each pick as if it were text.
  • Default: "nocase".
nonusersort (Optional) Set – Designates the special sorting behavior for picks that are not user-ordered when the same table mixes picks that are user-order with those that are non-user-ordered. Must be one of the following:
  • first – Picks that are not user-ordered are sorted before picks that are user-sorted.
  • last – Picks that are not user-ordered are sorted after picks that are user-sorted.
  • none – No differentiation is made between user-ordered picks and those that are not user-ordered.
  • Default: "none".

NOTE!  Any attempt by the user to move non-orderable picks will fail, as will any attempt to move user-ordered picks above or below non-orderable picks.

usernamable (Optional) Boolean – Indicates whether picks from this component should be user-namable. If a component allows naming, so does any derived component set, unless the component set explicitly says otherwise. Default: "no".
autocompset (Optional) Boolean – Indicates whether the Kit should automatically create a new component set with the identical unique id as the component. This new compset will possess exactly one component - this one. Default: "yes".
orderfield (Optional) Id – Unique id to be used when automatically defining a special field for the component that will track the details of user-ordering. If empty, then this component does not support user-ordered sequencing of its picks. Default: Empty.
unwind (Optional) Id – Unique id of the tag group to utilize for controlling "unwind" logic of picks derived from this component. The unwind mechanism ensures picks are deleted in the reverse order they are added. If omitted, no unwind logic is enabled for the component. Default: Empty.
isgear (Optional) Boolean – Indicates whether things derived from this component are considered to be "gear". The gear mechanism automatically provides additional logic to all things designated as gear. Default: "no".
denyboot (Optional) Boolean – Indicates whether things derived from this component are denied the ability to be bootstrapped from any source. Default: "no".
panellink (Optional) Id – Unique id of an edit panel that is associated with all things derived from this component as the default panel linkage. If a thing also specifies an explicit panel linkage, that will take precedence. If empty, no default panel linkage is established. Default: Empty.
hasshortname (Optional) Boolean – Indicates whether all compsets derived from this component should automatically incorporate the "short name" behavior provided by the Kit. Default: "no".
ispublic (Optional) Boolean – Indicates whether this component is displayed within the Editor when the user utilizes the "Find Things" mechanism. In general, internal "helper" components should be made non-public so that the user only interacts with components that will be familiar to them. Default: "yes".

The "component" element also possesses child elements that define various facets of the component. 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.

field Zero or more "field" elements may appear as defined by the given link. This element specifies the fields that exist for the component.
usage Zero or more "usage" elements may appear as defined by the given link. This element specifies the pick-based usage pools associated with all things derived from the component.
linkage Zero or more "linkage" elements may appear as defined by the given link. This element specifies the pick linkages that can be defined for all things derived from the component.
identity Zero or more "identity" elements may appear as defined by the given link. This element specifies any identity tag groups that are defined for the component.
containerreq Zero or more "containerreq" elements may appear as defined by the given link. This element specifies any container requirements for things derived from the component.
displace An optional "displace" element may appear as defined by the given link. This element specifies any displacement behaviors that the component must perform.
shadow An optional "shadow" element may appear as defined by the given link. This element specifies any shadowing behaviors that the component must perform.
creation An optional "creation" element may appear as defined by the given link. This element defines a Creation Script for the component.
deletion An optional "deletion" element may appear as defined by the given link. This element defines a Deletion Script for the component.
xactsetup An optional "xactsetup" element may appear as defined by the given link. This element defines an TransactSetup Script for the component.
xactbuy An optional "xactbuy" element may appear as defined by the given link. This element defines an TransactBuy Script for the component.
xactsell An optional "xactsell" element may appear as defined by the given link. This element defines an TransactSell Script for the component.
tag Zero or more "tag" elements may appear as defined by the given link. This element specifies any tags that are automatically assigned to every thing derived from the component.
bootstrap Zero or more "bootstrap" elements may appear as defined by the given link. This element specifies any things that are automatically bootstrapped to every thing derived from the component.
loadfixup An optional "loadfixup" element may appear as defined by the given link. This element defines a LoadFixup Script for the component.
eval Zero or more "eval" elements may appear as defined by the given link. This element specifies any Eval Scripts that must be performed for the component.
evalrule Zero or more "evalrule" elements may appear as defined by the given link. This element specifies any EvalRule Scripts that must be performed for the component.
prereq Zero or more "prereq" elements may appear as defined by the given link. This element specifies any pre-requisite tests that are applied to every thing derived from the component.
merge An optional "merge" element may appear as defined by the given link. This element defines a Merge Script for the component.
split An optional "split" element may appear as defined by the given link. This element defines a Split Script for the component.

The "usage" Element

The "usage" element defines a pick-based usage pool to associate with every thing for the component. The complete list of attributes for this element is below.

usage Id – Unique id of the usage pool to be associated with all picks derived from this component.

The "linkage" Element

The "linkage" element defines a linkage to another pick that is associated with every thing for the component. The complete list of attributes for this element is below.

linkage Id – Specifies the unique id of the linkage being defined for the component.
optional (Optional) Boolean – Indicates whether this linkage is optional or required for all picks. Default: "no".

The "identity" Element

The "identity" element defines an identity tag group for the component and all derived things. The complete list of attributes for this element is below.

group Id – Unique id of the tag group that will be used for identity handling of all things derived from this component.

NOTE! This tag group does not need to exist. If it does not, it is automatically created and setup appropriately by the Kit, but you may not add further dynamic tags to a tag group that is auto-created in this way.

The "displace" Element

The "displace" element defines the displacement behavior for the component and all derived things. The complete list of attributes for this element is below.

target (Optional) Set – Designates the target into which picks derived from this component will be displaced. Must be one of these values:
  • hero – Picks are displaced into the hero/actor, regardless of location in the structural hierarchy.
  • parent – Picks are displaced into the immediate container.
  • Default: "hero".
PCDATA TagExpr – Specifies a tag expression that determines whether an individual pick is displaced. This tag expression is applied to the pick itself - not the container. Furthermore, the tag expression does include tags that are automatically added to the pick at creation, such as auto-tags from a table or a bootstrap. The tag expression is only applied once, when the pick is first added to the container, after which the pick is either displaced or not for the rest of its existence.

The "shadow" Element

The "shadow" element defines the shadowing behavior for the component and all derived things. The complete list of attributes for this element is below.

target (Optional) Set – Designates the target into which picks derived from this component will be shadowed. Must be one of these values:
  • hero – Picks are shadowed into the hero/actor, regardless of location in the structural hierarchy.
  • parent – Picks are shadowed into the immediate container.
  • Default: "hero".
PCDATA TagExpr – Specifies a tag expression that determines whether an individual pick is shadowed. This tag expression is applied to the pick itself - not the container. Furthermore, the tag expression does include tags that are automatically added to the pick at creation, such as auto-tags from a table or a bootstrap. The tag expression is only applied once, when the pick is first added to the container, after which the pick is either shadowed or not for the rest of its existence.

The "creation" Element

The "creation" element defines a Creation Script for the component. The complete list of attributes for this element is below.

PCDATA Script – Specifies the code comprising the Creation script.

The "deletion" Element

The "deletion" element defines a Deletion Script for the component. The complete list of attributes for this element is below.

PCDATA Script – Specifies the code comprising the Deletion script.

The "xactsetup" Element

The "xactsetup" element defines an TransactSetup Script for the component. The complete list of attributes for this element is below.

PCDATA Script – Specifies the code comprising the TransactSetup script.

The "xactbuy" Element

The "xactbuy" element defines an TransactBuy Script for the component. The complete list of attributes for this element is below.

PCDATA Script – Specifies the code comprising the TransactBuy script.

The "xactsell" Element

The "xactsell" element defines an TransactSell Script for the component. The complete list of attributes for this element is below.

PCDATA Script – Specifies the code comprising the TransactSell script.

The "loadfixup" Element

The "loadfixup" element defines a LoadFixup Script for the component. The complete list of attributes for this element is below.

PCDATA Script – Specifies the code comprising the LoadFixup script.

The "merge" Element

The "merge" element defines a Merge Script for the component. The complete list of attributes for this element is below.

PCDATA Script – Specifies the code comprising the Merge script.

The "split" Element

The "split" element defines a Split Script for the component. The complete list of attributes for this element is below.

PCDATA Script – Specifies the code comprising the Split script.

Example

The following example demonstrates what a "component" element might look like. All default values are assumed for optional attributes.

<component id="WeaponBase" name="Weapon"
      autocompset="no" hasshortname="yes" panellink="armory">
  <field id="wpDamage" name="Damage" type="derived" maxlength="20"/>
  <field id="wpNetAtk" name="Net Attack" type="derived"/>
  <usage usagepool="mypool"/>
  <linkage linkage="attribute" optional="no"/>
  <identity group="Weapon"/>
  <displace target="hero">Helper.Displace</displace>
  <tag group="Equipment" tag="Hand"/>
  <eval index="1" phase="Final" priority="5000"><![CDATA[
    ~insert script code here
    ]]></eval>
  <evalrule value="1" phase="Validate" priority="5000" message="Resource overspent">
    ~insert script code here
    ]]></evalrule>
  <prereq message="Requirement not met">
    <match>Helper.WeapCheck</match>
    <valid><![CDATA[
      ~insert script code here
      ]]></valid>
    </prereq>
  </component>