Template Target References: Difference between revisions

From HLKitWiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{context|Kit Reference|Target References}}
{{context|Kit Reference|Target References}}
See Also: [[Template Context Transitions]]


The "template" script context governs the operations that can be applied to templates within layouts and tables. The complete list of target references for templates is presented in the table below.
The "template" script context governs the operations that can be applied to templates within layouts and tables. The complete list of target references for templates is presented in the table below.
Line 37: Line 39:
Example: this.visible = 1
Example: this.visible = 1
|-
|-
            { "issizing",  READONLY,  0,  false  },
|issizing
            { "inheader",  READONLY,  0,  false  }
|scrollbar
|(Right, Number) Returns non-zero if the "sizing" logic of a template within a table is being performed. This allows detection of the sizing logic so that all non-sizing behaviors can be skipped for the template.<br>
|(Right, Number) Returns non-zero if the "sizing" logic of a template within a table is being performed. This allows detection of the sizing logic so that all non-sizing behaviors can be skipped for the template.<br>
Example: result = this.issizing
Example: result = this.issizing
Line 52: Line 52:
|-
|-
|tagis[''tmpl'']
|tagis[''tmpl'']
|(Right, Number) Returns non-zero if any tags assigned to the pick match the tag template ''tmpl'', else zero if no tags match. The template must use the standard "group.id" syntax and may contain a wildcard.<br>
|(Right, Number) Returns non-zero if any tags assigned to the pick/thing associated with the template that match the tag template ''tmpl'', else zero if no tags match. The tag template must use the standard "group.id" syntax and may contain a wildcard.<br>
Example: this.tagis[skill.?]
Example: this.tagis[skill.?]
|-
|-
|tagcount[''tmpl'']
|tagcount[''tmpl'']
|(Right, Number) Returns the number of tags assigned to the thing that match the tag template ''tmpl''. The template must use the standard "group.id" syntax and may contain a wildcard.<br>
|(Right, Number) Returns the number of tags assigned to the pick/thing associated with the template that match the tag template ''tmpl''. The tag template must use the standard "group.id" syntax and may contain a wildcard.<br>
Example: result = this.tagcount[skill.?]
Example: result = this.tagcount[skill.?]
|-
|-
|tagvalue[''tmpl'']
|tagvalue[''tmpl'']
|(Right, Number) Returns the value of a tag assigned to the thing that matches the tag template ''tmpl''. The rules associated with tag values in tag expressions apply. The template must use the standard "group.id" syntax and may contain a wildcard.<br>
|(Right, Number) Returns the value of a tag assigned to the pick/thing associated with the template that matches the tag template ''tmpl''. The rules associated with tag values in tag expressions apply. The tag template must use the standard "group.id" syntax and may contain a wildcard.<br>
Example: result = this.tagvalue[spelllevel.wizard?]
Example: result = this.tagvalue[spelllevel.wizard?]
|-
|-
|tagmin[''tmpl'']
|tagmin[''tmpl'']
|(Right, Number) Returns the minimum value of all tags assigned to the thing that match the tag template ''tmpl''. The rules associated with tag values in tag expressions apply. The template must use the standard "group.id" syntax and may contain a wildcard.<br>
|(Right, Number) Returns the minimum value of all tags assigned to the pick/thing associated with the template that match the tag template ''tmpl''. The rules associated with tag values in tag expressions apply. The tag template must use the standard "group.id" syntax and may contain a wildcard.<br>
Example: result = this.tagmin[spelllevel.wizard?]
Example: result = this.tagmin[spelllevel.wizard?]
|-
|-
|tagmax[''tmpl'']
|tagmax[''tmpl'']
|(Right, Number) Returns the maximum value of all tags assigned to the thing that match the tag template ''tmpl''. The rules associated with tag values in tag expressions apply. The template must use the standard "group.id" syntax and may contain a wildcard.<br>
|(Right, Number) Returns the maximum value of all tags assigned to the pick/thing associated with the template that match the tag template ''tmpl''. The rules associated with tag values in tag expressions apply. The tag template must use the standard "group.id" syntax and may contain a wildcard.<br>
Example: result = this.tagmax[spelllevel.wizard?]
Example: result = this.tagmax[spelllevel.wizard?]
|-
|-
|tagunique[''tmpl'']
|tagunique[''tmpl'']
|(Right, Number) Returns the number of unique tags assigned to the thing that match the tag template ''tmpl''. If a tag is assigned multiple times, it is only counted once. The template must use the standard "group.id" syntax and may contain a wildcard.<br>
|(Right, Number) Returns the number of unique tags assigned to the pick/thing associated with the template that match the tag template ''tmpl''. If a tag is assigned multiple times, it is only counted once. The tag template must use the standard "group.id" syntax and may contain a wildcard.<br>
Example: result = this.tagunique[skill.?]
Example: result = this.tagunique[skill.?]
|-
|-
|tagexpr[''expr'']
|tagexpr[''expr'']
|(Right, Number) Returns non-zero if the tags assigned to the thing match the tag expression ''expr'', else zero is returned. The ''expr'' parameter must be a valid tag expression.<br>
|(Right, Number) Returns non-zero if the tags assigned to the pick/thing associated with the template match the tag expression ''expr'', else zero is returned. The ''expr'' parameter must be a valid tag expression.<br>
Example: result = this.tagexpr[class.wizard & (val:spelllevel.wizard? > 5)]
Example: result = this.tagexpr[class.wizard & (val:spelllevel.wizard? > 5)]
|-
|-
Line 100: Line 100:
|-
|-
|isidentity[''grp'']
|isidentity[''grp'']
|(Right, Number) As the counterpart of "setidentity", this target reference returns non-zero if the indicated identity tag has been assigned to the pick and zero if not. The identity tag sought must be from the tag group ''grp'' and the tag id is dictated by the initial context of the script. For more details, [[Identity Target References|please check here]].<br>
|(Right, Number) Returns non-zero if the indicated identity tag has been assigned to the pick/thing associated with the template. The identity tag sought must be from the tag group ''grp'' and the tag id is dictated by the initial context of the script. For more details, [[Identity Target References|please check here]].<br>
Example: result = this.isidentity[groupid]
Example: result = this.isidentity[groupid]
|-
|-
|autotop
|autoplace[''gap'']
|(Left, Right, Number) Accesses the position of the top edge of the auto-place region within the containing visual element.<br>
|(Right, Number) Automatically places the template within the containing layout, subject to the standard rules for [[Using Automatic Placement|automatic placement]]. The ''gap'' parameter specifies the gap to be used between this template and the previous placed element. The parameter can be omitted, in which case the established "autogap" is utilized. Automatic placement for templates can only be used within layouts. A value of zero is always returned.<br>
Example: result = this.autotop<br>
Example: perform this.autoplace[42]<br>
Example: this.autotop = 42
Example: perform this.autoplace
|-
|autobottom
|(Left, Right, Number) Accesses the position of the bottom edge of the auto-place region within the containing visual element.<br>
Example: result = this.autobottom<br>
Example: this.autobottom = 420
|-
|autoleft
|(Left, Right, Number) Accesses the position of the left edge of the auto-place region within the containing visual element.<br>
Example: result = this.autoleft<br>
Example: this.autoleft = 42
|-
|autoright
|(Left, Right, Number) Accesses the position of the right edge of the auto-place region within the containing visual element.<br>
Example: result = this.autoright<br>
Example: this.autoright = 420
|-
|-
|autowidth
|batchadd[''gap'']
|(Left, Right, Number) Accesses the width of the auto-place region within the containing visual element.<br>
|(Right, Number) Queues the template for batch placement within the containing layout, subject to the standard rules for [[Using Batch Placement|batch placement]]. As with "autoplace", the ''gap'' parameter specifies the gap to be used between this template and the previous placed element. The parameter can be omitted, in which case the established "autogap" is utilized. Batch placement for templates can only be used within layouts. A value of zero is always returned.<br>
Example: result = this.autowidth<br>
Example: perform this.batchadd[42]<br>
Example: this.autowidth = 420
Example: perform this.batchadd
|-
|autoheight
|(Left, Right, Number) Accesses the height of the auto-place region within the containing visual element.<br>
Example: result = this.autoheight<br>
Example: this.autoheight = 420
|-
|autogap
|(Left, Right, Number) Accesses the default gap size used when automatically placing elements within the containing visual element. The "autogap" defaults to zero.<br>
Example: result = this.autogap<br>
Example: this.autogap = 42
|-
|autoplace[''gap'']
|(Right, Number) Automatically places the layout within the containing visual element, subject to the standard rules for [[Using Automatic Placement|automatic placement]]. The ''gap'' parameter specifies the gap to be used between this layout and the previous placed element. The parameter can be omitted, in which case the established "autogap" is utilized.<br>
Example: this.autoplace[42]<br>
Example: this.autoplace
|-
|-
|}
|}

Latest revision as of 05:41, 20 December 2013

Context: HL Kit &#133; Kit Reference &#133; Target References 

See Also: Template Context Transitions

The "template" script context governs the operations that can be applied to templates within layouts and tables. The complete list of target references for templates is presented in the table below.

width (Left, Right, Number) Accesses the width of the template. Unless explicitly specified within the XML, the width of a template is automatically initialized. If the template is within a table, the width is set the interior width of the containing table, minus any assigned margins. Otherwise, the template is initialized to a width of 100.

Example: result = this.width
Example: this.width = 420

height (Left, Right, Number) Accesses the height of the template. Unless explicitly specified within the XML, the height of a layout is automatically initialized to zero and must be set by the author via a suitable script.

Example: result = this.height
Example: this.height = 420

left (Left, Right, Number) Accesses the position of the left edge of the template within the containing visual element.

Example: result = this.left
Example: this.left = 42

top (Left, Right, Number) Accesses the position of the top edge of the template within the containing visual element.

Example: result = this.top
Example: this.top = 42

right (Right, Number) Returns the position of the right edge of the template within the containing visual element.

Example: result = this.right

bottom (Right, Number) Returns the position of the bottom edge of the template within the containing visual element.

Example: result = this.bottom

visible (Left, Right, Number) Controls the visibility of the template within the containing visual element. A non-zero value indicates the template is visible and a zero value indicates hidden. The visibility of templates cannot be controlled within tables.

Example: result = this.visible
Example: this.visible = 1

issizing (Right, Number) Returns non-zero if the "sizing" logic of a template within a table is being performed. This allows detection of the sizing logic so that all non-sizing behaviors can be skipped for the template.

Example: result = this.issizing

inheader (Right, Number) Returns non-zero if the template is being positioned for use as a header within a table. This makes it possible to distinguish the context for a template that is being used as a dual-purpose header.

Example: result = this.inheader

scrollbar (Right, Number) Returns the width of a scroller, in pixels.

Example: result = this.scrollbar

tagis[tmpl] (Right, Number) Returns non-zero if any tags assigned to the pick/thing associated with the template that match the tag template tmpl, else zero if no tags match. The tag template must use the standard "group.id" syntax and may contain a wildcard.

Example: this.tagis[skill.?]

tagcount[tmpl] (Right, Number) Returns the number of tags assigned to the pick/thing associated with the template that match the tag template tmpl. The tag template must use the standard "group.id" syntax and may contain a wildcard.

Example: result = this.tagcount[skill.?]

tagvalue[tmpl] (Right, Number) Returns the value of a tag assigned to the pick/thing associated with the template that matches the tag template tmpl. The rules associated with tag values in tag expressions apply. The tag template must use the standard "group.id" syntax and may contain a wildcard.

Example: result = this.tagvalue[spelllevel.wizard?]

tagmin[tmpl] (Right, Number) Returns the minimum value of all tags assigned to the pick/thing associated with the template that match the tag template tmpl. The rules associated with tag values in tag expressions apply. The tag template must use the standard "group.id" syntax and may contain a wildcard.

Example: result = this.tagmin[spelllevel.wizard?]

tagmax[tmpl] (Right, Number) Returns the maximum value of all tags assigned to the pick/thing associated with the template that match the tag template tmpl. The rules associated with tag values in tag expressions apply. The tag template must use the standard "group.id" syntax and may contain a wildcard.

Example: result = this.tagmax[spelllevel.wizard?]

tagunique[tmpl] (Right, Number) Returns the number of unique tags assigned to the pick/thing associated with the template that match the tag template tmpl. If a tag is assigned multiple times, it is only counted once. The tag template must use the standard "group.id" syntax and may contain a wildcard.

Example: result = this.tagunique[skill.?]

tagexpr[expr] (Right, Number) Returns non-zero if the tags assigned to the pick/thing associated with the template match the tag expression expr, else zero is returned. The expr parameter must be a valid tag expression.

Example: result = this.tagexpr[class.wizard & (val:spelllevel.wizard? > 5)]

tagcountstr[str] (Right, Number) This target reference is identical to "tagcount", except that the str parameter is a string expression that is evaluated within the script. This allows the tag template to be dynamically determined via the script instead of being hard-wired at compilation.

Example: result = this.tagcountstr["skill.?"]

tagvaluestr[str] (Right, Number) This target reference is identical to "tagvalue", except that the str parameter is a string expression that is evaluated within the script. This allows the tag template to be dynamically determined via the script instead of being hard-wired at compilation.

Example: result = this.tagvaluestr["spelllevel.wizard?"]

tagminstr[str] (Right, Number) This target reference is identical to "tagmin", except that the str parameter is a string expression that is evaluated within the script. This allows the tag template to be dynamically determined via the script instead of being hard-wired at compilation.

Example: result = this.tagminstr["spelllevel.wizard?"]

tagmaxstr[str] (Right, Number) This target reference is identical to "tagmax", except that the str parameter is a string expression that is evaluated within the script. This allows the tag template to be dynamically determined via the script instead of being hard-wired at compilation.

Example: result = this.tagmaxstr["spelllevel.wizard?"]

taguniquestr[str] (Right, Number) This target reference is identical to "tagunique", except that the str parameter is a string expression that is evaluated within the script. This allows the tag template to be dynamically determined via the script instead of being hard-wired at compilation.

Example: result = this.taguniquestr["skill.?"]

isidentity[grp] (Right, Number) Returns non-zero if the indicated identity tag has been assigned to the pick/thing associated with the template. The identity tag sought must be from the tag group grp and the tag id is dictated by the initial context of the script. For more details, please check here.

Example: result = this.isidentity[groupid]

autoplace[gap] (Right, Number) Automatically places the template within the containing layout, subject to the standard rules for automatic placement. The gap parameter specifies the gap to be used between this template and the previous placed element. The parameter can be omitted, in which case the established "autogap" is utilized. Automatic placement for templates can only be used within layouts. A value of zero is always returned.

Example: perform this.autoplace[42]
Example: perform this.autoplace

batchadd[gap] (Right, Number) Queues the template for batch placement within the containing layout, subject to the standard rules for batch placement. As with "autoplace", the gap parameter specifies the gap to be used between this template and the previous placed element. The parameter can be omitted, in which case the established "autogap" is utilized. Batch placement for templates can only be used within layouts. A value of zero is always returned.

Example: perform this.batchadd[42]
Example: perform this.batchadd