Trigger Script

From HLKitWiki
Revision as of 08:58, 20 February 2009 by Rob (talk | contribs)
(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? Yes
Where Used: Portals
Procedure Use: "trigger" type, "pick" context

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