Creation Script

From HLKitWiki
Revision as of 08:46, 20 February 2009 by Rob (talk | contribs) (→‎Technical Details)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Context: HL Kit … Kit Reference … Script Types 

Technical Details

Initial Context: Pick
Alternate Context: None
Fields Finalized? No
Where Used: Components
Procedure Use: None

The Integrity script utilizes the following special symbols:

-None- There are no special symbols for a Creation script.

Description

The Creation script is defined for components, and it pertains to all picks that derived from a given component. The script is invoked a single time when a pick is first created. As such, its primary use is for performing special setup and/or configuration of picks.

For example, in the d20 System, there is an optional rule where characters always receive maximum hit points for each new level. This can be handled quite easily via a Creation script. If the user has enabled the setting, the hit points are set to the maximum, else they are set to zero so that the user needs to modify them appropriately.

When invoked, a Creation script starts with the pick as its initial context. There is generally no reason to navigate outside the context of the pick, but it is technically allowed. The primary focus will be on the pick and its fields.

Example

Using the d20 System example cited above, the Creation script below will properly initialize the hit points field for a new class level based on the configuration setting.

if (hero.tagis[source.MaxHP] <> 0) then
  field[lvlHP].value = field[lvlHitDice].value
else
  field[lvlHP].value = 0
  endif