Creation Script: Difference between revisions

From HLKitWiki
Jump to navigationJump to search
New page: {{context|Kit Reference|Script Types}} ==Technical Details== :{| class="scripttable" |class="leftnormal"|Initial Context: |Pick |- |Alternate Context: |None |- |Fields F...
 
No edit summary
Line 12: Line 12:
|Fields Finalized?
|Fields Finalized?
|No
|No
|-
|Where Used:
|[[Component Element (Data)|Components]]
|-
|-
|}
|}

Revision as of 00:09, 16 December 2008

Context: HL Kit … Kit Reference … Script Types 

Technical Details

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

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