Procedure Element (Data)

From HLKitWiki
Revision as of 19:25, 30 November 2008 by Rob (Talk | contribs) (New page: {{context|Kit Reference|Data File Reference}} ==The "procedure" Element== If you need to invoke the same script code from multiple scripts, then you should consider writing a [[Re-usable...)

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

Context: HL KitKit Reference … Data File Reference 

The "procedure" Element

If you need to invoke the same script code from multiple scripts, then you should consider writing a re-usable procedure that defines the code once and can be called from multiple scripts. Each procedure is defined through the use of a "procedure" element. The complete list of attributes for this element is below.

id Id – Specifies the unique id of the procedure. This id is used in all references to the procedure.
context (Optional) Set – Designates a general script context from which this procedure is designed to be called. A script context spans multiple different script types that are related in nature and behavior. Must be one of these values:

unknown – Procedure may only be invoked from within a specific type of script, as dictated by the "scripttype" attribute (below).
pick – Procedure can be called from any script with a pick as its initial context.
container – Procedure can be called from any script with a container as its initial context.
entity – Procedure can be called from entity-related scripts, such as the Change Script or Titlebar Script.
visual – Procedure can be called from any visual script, such as the Position Script.
info – Procedure can be called from any information synthesis script for a thing or pick, such as the MouseInfo Script or Description Script.
transact – Procedure can be called from any transaction script, such as the TransactBuy Script or TransactSell Script.
combat – Procedure can be called from any combat-related script, such as the NewCombat Script or Integrate Script.
Default: "unknown".

scripttype (Optional) Set – Designates the specific script type from which this procedure may be called. The procedure may only be called from scripts of this type. Must be one of these values:

none –
any –
finalize –
calculate –
bounds –
eval –
mouseinfo –
titlebar –
description –
trigger –
label –
evalrule –
prereq –
xactsetup –
xactbuy –
xactsell –
newcombat –
newturn –
integrate –
dossier –
Default: "any".

PCDATA Script – Specifies the code comprising the procedure.

Example

The following example demonstrates what a "procedure" element might look like. All default values are assumed for optional attributes.