OutputLabel Element (Data)

From HLKitWiki
Revision as of 10:57, 2 December 2008 by Rob (talk | contribs)
Jump to navigationJump to search

Context: HL Kit … Kit Reference … Data File Reference … Portal Element (Data) 

The "output_label" Element

The role of the "output_label" element is identical to the "label" element, except that it is designed for use exclusively within character sheet output. Any data that you want to display within a sheet (i.e. most everything within a sheet) will require the use of an "output_label" element. The complete list of attributes for this element is below.

IMPORTANT! Only one mechanism for specifying the label contents may be employed within a given output label portal. That means you may use either the "text" attribute, the "field" attribute, or the "labeltext" script to define the contents. Use of multiple mechanisms will result in a compilation error.

text (Optional) Text – Specifies a string of literal text to be displayed within the label. Default: Empty.
field (Optional) Id – Specifies the unique id of the field whose value is to be displayed within the label. The field must exist within the pick/thing associated with the containing template. If this portal is not defined within a template, a field-based label is not allowed. Default: Empty.
ismultiline (Optional) Boolean – Indicates whether the label text is to be treated as multi-line or merely a single line of output. Default: "no".

The "output_label" element also possesses child elements that define additional behaviors of the portal. 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.

labeltext An optional "labeltext" element may appear as defined by the given link. This element defines a Label Script that is used for synthesizing the text to be output.

The "labeltext" Element

The "labeltext" element defines a Label Script for the portal. The complete list of attributes for this element is below.

PCDATA Script – Specifies the code comprising the Label script.

Example

The following example demonstrates what an output label portal might look like. All default values are assumed for optional attributes.

<portal id="name" style="outNameLg">
  <output_label field="name"/>
  </portal>

<portal id="oHeroName" style="outHeroNam">
  <output_label>
    <labeltext>
      @text = hero.actorname
      var result as number
      result = compare(@text, "")
      if (result = 0) then
        @text = "- Unnamed Hero -"
        endif
      </labeltext>
    </output_label>
  </portal>