Deletion 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... |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 12: | Line 12: | ||
|Fields Finalized? | |Fields Finalized? | ||
|No | |No | ||
|- | |||
|Where Used: | |||
|[[Component Element (Data)|Components]] | |||
|- | |||
|Procedure Use: | |||
|None | |||
|- | |- | ||
|} | |} | ||
Line 19: | Line 25: | ||
:{| class="infotable" | :{| class="infotable" | ||
|class="leftnormal"|-None- | |class="leftnormal"|-None- | ||
|There are no special symbols for a | |There are no special symbols for a Deletion script. | ||
|- | |- | ||
|} | |} |
Latest revision as of 08:46, 20 February 2009
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 Deletion script.
Description
The Deletion script is the analog of the Creation script. The script pertains to all picks that are derived from a given component, and it is invoked a single time just before a pick is finally destroyed. As such, its primary use is for performing special wrapup handling of picks.
This script is rarely used, but it is quite necessary in those places. The easiest example is with usage pools, such as those used by the journal mechanism. Each journal pick adds its awards (e.g. XP, cash) to the overall usage pools maintained for the actor. But if the user deletes a journal pick, it's critical that the awards conferred by the pick be subtracted back out. Enter the Deletion script, which serves perfectly for this purpose.
When invoked, a Deletion 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 example cited above, the Deletion script below will properly subtract out the adjustments from a journal pick before it is destroyed.
perform hero.usagepool[TotalXP].adjust[-usagepool[JrnlXP].value] perform hero.usagepool[TotalCash].adjust[-usagepool[JrnlCash].value]