Merge 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: |[[Pick Context|Pi...
 
No edit summary
Line 12: Line 12:
|Fields Finalized?
|Fields Finalized?
|Yes
|Yes
|-
|Where Used:
|[[Component Element (Data)|Components]]
|-
|-
|}
|}

Revision as of 00:21, 16 December 2008

Context: HL Kit … Kit Reference … Script Types 

Technical Details

Initial Context: Pick
Alternate Context: Pick
Fields Finalized? Yes
Where Used: Components

The Merge script utilizes the following special symbols:

-None- There are no special symbols for the Merge script.

Description

The Merge script is used to handle the merging of two separate picks into one via stacking behavior. It is invoked whenever the user performs a merge operation of stackable gear. The goal of the script is to allow authors to properly reconcile whatever fields are necessary for an accurate merging of the two picks.

The Merge script is defined for a component. As such, it is inherited into every thing that derived from that component. Each script is intended to properly merge the fields within that component and nothing else. This ensures that a thing derived from multiple components, each with their own Merge script, will perform appropriate merge behavior without incident.

When invoked, the Merge script starts out with a pick as its initial context. However, there are two picks involved in the merge operation. When a merge takes place, there is the pick that is assimilating the other (e.g. increasing its quantity) and the pick that is ultimately deleted once the merge completes. The initial context is the pick that is being assimilated into. The second pick is made available via an alternate pick context, which can be accessed via the "altpick" context. This makes it possible to assimilate one pick into the other, regardless of what fields or behaviors are involved.

Example

The sample Merge script below adds the pertinent quantities of the pick being merged into the pick that is being assimilated into.

field[trkMax].value += altpick.field[trkMax].value
field[trkUser].value += altpick.field[trkUser].value