Position Script

From HLKitWiki
Revision as of 00:12, 8 December 2008 by Rob (talk | contribs)
Jump to navigationJump to search

Context: HL Kit … Kit Reference … Script Types 

Description

The location of visual elements on the display is controlled via a number of different scripts. The location of templates is controlled via the Position script. Since templates are displayed within layouts that contain multiple visual elements, the actual position and dimensions of a template are usually controlled by its container. However, within the Position script, the location and dimensions of the portals within the template are also controlled. These portals are always positioned relative to the upper left corner of the template itself, so keep this in mind when performing any calculations.

NOTE! The Position script is read-only with respect to the contents of the portfolio, although visual elements may be modified. Within this script, all aspects of the hierarchy can be accessed, but nothing can be changed.

Technical Details

Initial Context: Scene or Layout or Template
Alternate Context: None
Fields Finalized? Yes

Special Symbols

-None- There are no special symbols for a Position script

Example

For an example, we'll assume that we have a template that contains two portals: a label portal and a edit portal. The label portal is simply a literal string that is used to indicate the contents of the edit portal. The edit portal allows the user to modify the contents of a field within the pick, just like the hero's name is presented atop the display when using the d20 System data files. We assume that the location of the template itself is controlled by its container, with the template controlling its width and its contents. The Position script for a simple template like this might look like below:

portal[stLblName].width = portal[stLblName].textwidth
portal[stEdtName].left = portal[stLblName].right + 15
portal[stEdtName].height = portal[stEdtName].fontheight + 2
width = portal[stEdtName].right