Trigger Script: Difference between revisions
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? | ||
|Yes | |Yes | ||
|- | |||
|Where Used: | |||
|[[Portal Element (Data)|Portals]] | |||
|- | |- | ||
|} | |} |
Revision as of 00:19, 16 December 2008
Context: HL Kit … Kit Reference … Script Types
Technical Details
The Trigger script utilizes the following special symbols:
-None- There are no special symbols for a Trigger script.
Description
The Trigger script is used in conjunction with the "trigger" action portal, which makes it possible for the user to invoke a one-time operation. The primary use of the Trigger script is for either resetting values (e.g. trackers on the In-Play tab) or applying adjustments to usage pools (e.g. damage tracking). In the latter case, there will typically be an edit portal where the user can enter a value. When the Trigger script is invoked, the value is used when applying the adjustment to the usage pool, and then the field is reset.
When invoked, a Trigger 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
We'll use the Trigger script associated with the button to reset all damage on the In-Play tab as an example. In this script, the usage pools for damage tracking are reset.
~if there is no history to undo, notify the user if (hero.usagepool[DmgNet].count = 0) then notify "Undo history is empty" done endif ~empty out both usage pools perform hero.usagepool[DmgNet].empty perform hero.usagepool[DmgAdjust].empty