Difference between revisions of "Template Element (Data)"

From HLKitWiki
Jump to: navigation, search
(The "live" Element{{anchor|live}})
 
(2 intermediate revisions by the same user not shown)
Line 33: Line 33:
  
 
The "template" element also possesses child elements that define various facets of the template. 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.
 
The "template" element also possesses child elements that define various facets of the template. 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.
 
{ &l_live, e_xml_optional },
 
{ &l_portal, e_xml_one_plus },
 
{ &l_position, e_xml_optional },
 
{ &l_header, e_xml_optional }
 
  
 
:{| class="infotable"
 
:{| class="infotable"
|class="leftnormal"|[[#fieldval|fieldval]]
+
|class="leftnormal"|[[#live|live]]
|Zero or more "fieldval" elements may appear as defined by the given link. This element specifies the starting value for individual fields within the thing.
+
|An optional "live" element may appear as defined by the given link. This element defines a [[Live Tag Expression]] that determines whether the template is shown to the user.
 
|-
 
|-
|[[#arrayval|arrayval]]
+
|[[Portal Element (Data)|portal]]
|Zero or more "arrayval" elements may appear as defined by the given link. This element specifies the starting value for individual array and matrix elements within the thing.
+
|One or more "portal" elements must appear as defined by the given link. This element specifies the individual portals which exist within the template.
 
|-
 
|-
|[[#usesource|usesource]]
+
|[[#position|position]]
|Zero or more "usesource" elements may appear as defined by the given link. This element specifies the sources relied upon for this thing to be accessible to the user.
+
|An optional "position" element may appear as defined by the given link. This element defines a [[Position Script]] through which the portals are sized and positioned within the template.
 
|-
 
|-
|[[Tag Element (Data)|tag]]
+
|[[#header|header]]
|Zero or more "tag" elements may appear as defined by the given link. This element specifies any tags that are automatically assigned to the thing.
+
|An optional "header" element may appear as defined by the given link. This element defines a [[Header Script]] that coordinates the sizing and positioning of portals used within the header for the template.
|-
+
|[[Bootstrap Element (Data)|bootstrap]]
+
|Zero or more "bootstrap" elements may appear as defined by the given link. This element specifies any things that are automatically bootstrapped when this thing is added to a container.
+
|-
+
|[[ContainerReq Element (Data)|containerreq]]
+
|Zero or more "containerreq" elements may appear as defined by the given link. This element specifies any container requirements for the thing.
+
|-
+
|[[#gear|gear]]
+
|An optional "gear" element may appear as defined by the given link. This element defines a [[Gear Script]] for the thing to calculate its weight.
+
|-
+
|[[#link|link]]
+
|Zero or more "link" elements may appear as defined by the given link. This element specifies the specific [[Pick Linkages|pick linkages]] that exist for this thing.
+
|-
+
|[[Eval Element (Data)|eval]]
+
|Zero or more "eval" elements may appear as defined by the given link. This element specifies any [[Eval Script|Eval Scripts]] that must be performed for the thing.
+
|-
+
|[[EvalRule Element (Data)|evalrule]]
+
|Zero or more "evalrule" elements may appear as defined by the given link. This element specifies any [[EvalRule Script|EvalRule Scripts]] that must be performed for the thing.
+
|-
+
|[[#pickreq|pickreq]]
+
|Zero or more "pickreq" elements may appear as defined by the given link. This element specifies any [[Dependencies on Specific Things|dependencies upon other picks]] within the container.
+
|-
+
|[[#exprreq|exprreq]]
+
|Zero or more "exprreq" elements may appear as defined by the given link. This element specifies any [[Expression-Based Requirements|expression-based dependencies ]] upon the state of the container.
+
|-
+
|[[PreReq Element (Data)|prereq]]
+
|Zero or more "prereq" elements may appear as defined by the given link. This element specifies any [[General Pre-Requisites|pre-requisite tests]] that are applied to the thing.
+
|-
+
|[[#child|child]]
+
|An optional "child" element may appear as defined by the given link. This element defines the particulars of a child entity that is attached by the thing.
+
|-
+
|[[#minion|minion]]
+
|An optional "minion" element may appear as defined by the given link. This element defines the particulars of a minion that is attached by the thing.
+
 
|-
 
|-
 
|}
 
|}
  
==The "fieldval" Element{{anchor|fieldval}}==
+
==The "live" Element{{anchor|live}}==
  
The "fieldval" element defines the starting values to use for various fields within the thing. To initialize elements within arrays and matrices, please see the "arrayval" element (below). The complete list of attributes for this element is below.  
+
The "live" element defines a [[Live Tag Expression]] for the template, which determines whether the template is shown. The tag expression is compared against the tags assigned to the container associated with the template (e.g. the actor). If the tag expression is satisfied, the template is visible, else it is hidden. The complete list of attributes for this element is below.  
  
 
:{| class="infotable"
 
:{| class="infotable"
|class="leftnormal"|field
+
|class="leftnormal"|PCDATA
|Id Unique id of the field for which to specify a starting value.
+
|TagExpr Specifies the code comprising the Live tag expression.
|-
+
|value
+
|Text – Starting value to assign to the field. If the field is text-based, the value is simply assigned, although it may be truncated if it exceeds the defined maximum length for the field. If the field is value-based, the text is converted to a floating point value and assigned.
+
 
|-
 
|-
 
|}
 
|}
  
==The "arrayval" Element{{anchor|arrayval}}==
+
==The "position" Element{{anchor|position}}==
  
The "arrayval" element defines the starting values to use for individual elements within array and matrix fields of the thing. To initialize elements within fields that are not an array or matrix, please see the "fieldval" attribute (above). The complete list of attributes for this element is below.  
+
The "position" element defines a [[Position Script]] for the template, which performs all the appropriate sizing and positioning of the contained portals within the region of the template. The complete list of attributes for this element is below.  
  
 
:{| class="infotable"
 
:{| class="infotable"
|class="leftnormal"|field
+
|class="leftnormal"|PCDATA
|Id – Unique id of the field for which to specify a starting value. If the field is not an array or matrix, an error is reported.
+
|Script – Specifies the code comprising the Position script.
|-
+
|index
+
|Integer – Specifies the row index of the element to be initialized. The first element of arrays and matrices is index zero.
+
|-
+
|column
+
|(Optional) Integer – Specifies the column of the element to be initialized within a matrix. The first element of matrices is index zero. This attribute is required for matrix elements and may be omitted for array elements. Default: Empty.
+
|-
+
|value
+
|Text – Starting value to assign to the field element. If the field is text-based, the value is simply assigned, although it may be truncated if it exceeds the defined maximum length for the field. If the field is value-based, the text is converted to a floating point value and assigned.
+
 
|-
 
|-
 
|}
 
|}
  
==The "usesource" Element{{anchor|usesource}}==
+
==The "header" Element{{anchor|header}}==
  
The "usesource" element specifies a [[Sources|source]] that this thing is dependent upon. If the designated source is not enabled by the user, this thing will be treated as not existing for the character. You may define a new source on-the-fly via this element by providing a new unique id and the appropriate additional information. However, you should typically avoid doing so, since you cannot control important facets of sources with just-in-time definition. The complete list of attributes for this element is below.
+
The "header" element defines a [[Header Script]] for the template, which works exactly like the Position script, except for the portals it manipulates. This script is only used if the template is used as a dual header and contains specifically designated header portals. The complete list of attributes for this element is below.  
 
+
:{| class="infotable"
+
|class="leftnormal"|source
+
|Id – Specifies the unique id of the source with which to establish a dependence.
+
|-
+
|name
+
|(Optional) Text – Name to be displayed to the user for this source. Maximum length is 50 characters. If the source already exists, this attribute can be left empty. Default: Empty.
+
|-
+
|parent
+
|(Optional) Id – Specifies the unique id of a different source that is treated as the parent of this source. All sources are displayed in a hierarchy within the "Configure Hero" form. If the source already exists, this attribute can be left empty and the behaviors of the existing source are utilized. If empty and the source does not yet exist, the new source is presented to the user as a top-level selection. Default: Empty.
+
|-
+
|}
+
 
+
==The "gear" Element{{anchor|gear}}==
+
 
+
The "gear" element defines a [[Gear Script]] for the thing, which is used to calculate the weight of held items and perform additional gear processing on the thing. The complete list of attributes for this element is below.  
+
  
 
:{| class="infotable"
 
:{| class="infotable"
 
|class="leftnormal"|PCDATA
 
|class="leftnormal"|PCDATA
|Script – Specifies the code comprising the Gear script.
+
|Script – Specifies the code comprising the Header script.
|-
+
|}
+
 
+
==The "link" Element{{anchor|link}}==
+
 
+
The "link" element defines a [[Pick Linkages|linkage to another thing]] based on the set of possible linkages defined for the underlying components. The complete list of attributes for this element is below.
+
 
+
:{| class="infotable"
+
|class="leftnormal"|linkage
+
|Id – Unique id of the linkage that is being setup for this thing.
+
|-
+
|thing
+
|Id – Unique id of the thing to which the linkage should be established.
+
|-
+
|}
+
 
+
==The "pickreq" Element{{anchor|pickreq}}==
+
 
+
The "pickreq" element defines a [[Dependencies on Specific Things|dependency on a specific thing]] whose existence is important within the container. The complete list of attributes for this element is below.
+
 
+
:{| class="infotable"
+
|class="leftnormal"|thing
+
|Id – Unique id of the thing upon which the dependency is being established.
+
|-
+
|iserror
+
|(Optional) Boolean – Indicates whether failure of the requirement should be treated as an error or merely a warning. Default: "yes".
+
|-
+
|ispreclude
+
|(Optional) Boolean – Indicates whether the specified thing must exist or must not exist within the container in order for the requirement to be satisfied. Preclusion implies that the thing is not allowed to exist. Default: "no".
+
|-
+
|}
+
 
+
==The "exprreq" Element{{anchor|exprreq}}==
+
 
+
The "exprreq" element defines a [[Expression-Based Requirements|dependency on an arithmetic expression]] that must be satisfied by the container. The complete list of attributes for this element is below.
+
 
+
:{| class="infotable"
+
|class="leftnormal"|message
+
|Text – Specifies the message to be reported if the requirement is not satisfied.
+
|-
+
|iserror
+
|(Optional) Boolean – Indicates whether failure of the requirement should be treated as an error or merely a warning. Default: "yes".
+
|-
+
|PCDATA
+
|TagExpr – Specifies an arithmetic expression that is applied to the container to determine whether the requirement is satisfied. The expression must be a valid chunk of script code that can be placed between the parentheses in a standard "if/then" statement (e.g. "if (expr) then").
+
|-
+
|}
+
 
+
==The "child" Element{{anchor|child}}==
+
 
+
The "child" element specifies an entity that is always added as a [[Advanced Gizmos|child gizmo]] of the thing. The complete list of attributes for this element is below.
+
 
+
:{| class="infotable"
+
|class="leftnormal"|entity
+
|Id – Specifies the unique id of the entity to be attached as a child gizmo.
+
|-
+
|}
+
 
+
The "child" element also possesses child elements that tailor the entity. 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.
+
 
+
:{| class="infotable"
+
|class="leftnormal"|[[Tag Element (Data)|tag]]
+
|Zero or more "tag" elements may appear as defined by the given link. This element specifies any tags that are automatically assigned to the gizmo when it is created.
+
|-
+
|[[Bootstrap Element (Data)|bootstrap]]
+
|Zero or more "bootstrap" elements may appear as defined by the given link. This element specifies any things that are automatically bootstrapped into the gizmo when it is created.
+
|-
+
|}
+
 
+
==The "minion" Element{{anchor|minion}}==
+
 
+
The "minion" element specifies that the thing always [[Minions and Masters|attaches a minion]]. The complete list of attributes for this element is below.
+
 
+
:{| class="infotable"
+
|class="leftnormal"|id
+
|Id – Specifies the unique id to be used for the minion attached via this thing.
+
|-
+
|ownmode
+
|(Optional) Boolean – Indicates whether the minion has an independent creation/advancement mode from its master. In some cases, you will want the minion to possess the same behavior as the master and transition with the master. However, if the minion is constructed as an independent character, you may want to handle advancement separately. Default: "yes".
+
|-
+
|isinherit
+
|(Optional) Boolean – Indicates whether the minion inherits the set of enabled sources from its master. If inheritance is active, the source selections for the master are locked in for the minion, with any changes to the master being immediately reflected within the minion. Default: "no".
+
|-
+
|}
+
 
+
The "minion" element also possesses child elements that tailor the minion. 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.
+
 
+
:{| class="infotable"
+
|class="leftnormal"|[[Tag Element (Data)|tag]]
+
|Zero or more "tag" elements may appear as defined by the given link. This element specifies any tags that are automatically assigned to the minion when it is created.
+
|-
+
|[[Bootstrap Element (Data)|bootstrap]]
+
|Zero or more "bootstrap" elements may appear as defined by the given link. This element specifies any things that are automatically bootstrapped into the minion when it is created.
+
 
|-
 
|-
 
|}
 
|}

Latest revision as of 02:37, 4 December 2008

Context: HL KitKit Reference … Data File Reference 

The "template" Element

Templates are collection of related portals that are all linked to a common thing or pick. Each template is specified through the use of a "template" element. The complete list of attributes for this element is below.

id Id – Specifies the unique id of the template. This id is used in all references to the template.
name Text – Public name associated with the template. Maximum length of 50 characters.
compset Id – Specifies the unique id of the component set that things/picks shown within the template derive from.
width (Optional) Integer – Specifies the initial width to be utilized for the template. If empty, the width is automatically determined by a set of rules. Default: Empty.
height (Optional) Integer – Specifies the initial height to be utilized for the template. Default: "100".
marginhorz (Optional) Integer – Specifies the margin gap included at both ends along the horizontal axis. The usable width of the template is the actual width minus double the horizontal margin. Default: "0".
marginvert (Optional) Integer – Specifies the margin gap included at both ends along the vertical axis. The usable height of the template is the actual height minus double the vertical margin. Default: "0".
istransaction (Optional) Boolean – Indicates whether this template is intended for use with buy or sell transactions. Default: "no".

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

live An optional "live" element may appear as defined by the given link. This element defines a Live Tag Expression that determines whether the template is shown to the user.
portal One or more "portal" elements must appear as defined by the given link. This element specifies the individual portals which exist within the template.
position An optional "position" element may appear as defined by the given link. This element defines a Position Script through which the portals are sized and positioned within the template.
header An optional "header" element may appear as defined by the given link. This element defines a Header Script that coordinates the sizing and positioning of portals used within the header for the template.

The "live" Element

The "live" element defines a Live Tag Expression for the template, which determines whether the template is shown. The tag expression is compared against the tags assigned to the container associated with the template (e.g. the actor). If the tag expression is satisfied, the template is visible, else it is hidden. The complete list of attributes for this element is below.

PCDATA TagExpr – Specifies the code comprising the Live tag expression.

The "position" Element

The "position" element defines a Position Script for the template, which performs all the appropriate sizing and positioning of the contained portals within the region of the template. The complete list of attributes for this element is below.

PCDATA Script – Specifies the code comprising the Position script.

The "header" Element

The "header" element defines a Header Script for the template, which works exactly like the Position script, except for the portals it manipulates. This script is only used if the template is used as a dual header and contains specifically designated header portals. The complete list of attributes for this element is below.

PCDATA Script – Specifies the code comprising the Header script.

Example

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

<template id="baAttrPick" name="Attribute Pick" compset="Attribute"
    marginhorz="18" marginvert="9">
  <portal id="name" style="lblXLarge" showinvalid="yes">
    <label field="name"/>
    </portal>
  <portal id="value" style="incrSimple">
    <incrementer field="trtUser"/>
    <mouseinfo mousepos="middle+above">
      @text = "Adjust attribute by clicking on the arrows."
      </mouseinfo>
    </portal>
  <portal id="info" style="actInfo">
    <action action="info"/>
    </portal>
  <position><![CDATA[
    ~set up our height based on our tallest portal
    height = portal[info].height

    ~if this is a "sizing" calculation, we're done
    if (issizing <> 0) then
      done
      endif

    ~position our tallest portal at the top
    portal[info].top = 0

    ~center the other portals vertically
    perform portal[name].centervert
    perform portal[value].centervert

    ~position the info portal on the far right
    perform portal[info].alignedge[right,0]

    ~position the incrementer to the left of the info portal (plus a gap)
    perform portal[value].alignrel[rtol,info,-10]

    ~position the name on the left and limit its width to available space
    portal[name].left = 0
    portal[name].width = minimum(portal[name].width,portal[value].left - portal[name].left - 10)
    </position>
  </template>