Merge Script

From HLKitWiki
Revision as of 01:00, 20 February 2009 by Rob (Talk | contribs) (Technical Details)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Context: HL KitKit Reference … Script Types 

Technical Details

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

The Merge script utilizes the following special symbols:

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


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.


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