Difference between revisions of "Procedure Element (Data)"

From HLKitWiki
Jump to: navigation, search
(The "procedure" Element)
(The "procedure" Element)
 
(3 intermediate revisions by one other user not shown)
Line 15: Line 15:
 
<li>pick – Procedure can be called from any script with a pick as its initial context.</li>
 
<li>pick – Procedure can be called from any script with a pick as its initial context.</li>
 
<li>container – Procedure can be called from any script with a container as its initial context.</li>
 
<li>container – Procedure can be called from any script with a container as its initial context.</li>
<li>entity – Procedure can be called from entity-related scripts, such as the [[Titlebar Script]].</li>
+
<li>entity – Procedure can be called from entity-related scripts, such as the [[TitleBar Script]].</li>
<li>visual – Procedure can be called from any visual script, such as the [[Position Script]].</li>
+
 
<li>info – Procedure can be called from any information synthesis script for a thing or pick, such as the [[MouseInfo Script]].</li>
 
<li>info – Procedure can be called from any information synthesis script for a thing or pick, such as the [[MouseInfo Script]].</li>
 
<li>transact – Procedure can be called from any transaction script, such as the [[TransactBuy Script]].</li>
 
<li>transact – Procedure can be called from any transaction script, such as the [[TransactBuy Script]].</li>
Line 33: Line 32:
 
<li>evalrule – Procedure may only be called from within an [[EvalRule Script]].</li>
 
<li>evalrule – Procedure may only be called from within an [[EvalRule Script]].</li>
 
<li>mouseinfo – Procedure may only be called from within a [[MouseInfo Script]].</li>
 
<li>mouseinfo – Procedure may only be called from within a [[MouseInfo Script]].</li>
<li>titlebar – Procedure may only be called from within a [[Titlebar Script]].</li>
+
<li>titlebar – Procedure may only be called from within a [[TitleBar Script]].</li>
 
<li>description – Procedure may only be called from within a [[Description Script]].</li>
 
<li>description – Procedure may only be called from within a [[Description Script]].</li>
 
<li>trigger – Procedure may only be called from within a [[Trigger Script]].</li>
 
<li>trigger – Procedure may only be called from within a [[Trigger Script]].</li>
Line 42: Line 41:
 
<li>xactsell – Procedure may only be called from within a [[TransactSell Script]].</li>
 
<li>xactsell – Procedure may only be called from within a [[TransactSell Script]].</li>
 
<li>newcombat – Procedure may only be called from within a [[NewCombat Script]].</li>
 
<li>newcombat – Procedure may only be called from within a [[NewCombat Script]].</li>
 +
<li>endcombat – Procedure may only be called from within an [[EndCombat Script]].</li>
 
<li>newturn – Procedure may only be called from within a [[NewTurn Script]].</li>
 
<li>newturn – Procedure may only be called from within a [[NewTurn Script]].</li>
 
<li>integrate – Procedure may only be called from within an [[Integrate Script]].</li>
 
<li>integrate – Procedure may only be called from within an [[Integrate Script]].</li>
 
<li>synthesize – Procedure may only be called from within a [[Synthesize Script]].</li>
 
<li>synthesize – Procedure may only be called from within a [[Synthesize Script]].</li>
 +
<li>change– Procedure may only be called from within a [[Change Script]].</li>
 
<li>none – Procedure may be called from '''any''' type of script. However, there is no initial context for identifiers, so no context transitions may be specified that don't explicitly designate a safe initial context (e.g. "hero."). This procedure type is useful when all inputs can be passed via variables and all results returned via variables.<li>
 
<li>none – Procedure may be called from '''any''' type of script. However, there is no initial context for identifiers, so no context transitions may be specified that don't explicitly designate a safe initial context (e.g. "hero."). This procedure type is useful when all inputs can be passed via variables and all results returned via variables.<li>
 
<li>Default: "unknown".</li>
 
<li>Default: "unknown".</li>

Latest revision as of 22:48, 19 December 2013

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 TitleBar Script.
  • info – Procedure can be called from any information synthesis script for a thing or pick, such as the MouseInfo Script.
  • transact – Procedure can be called from any transaction script, such as the TransactBuy Script.
  • combat – Procedure can be called from any combat-related script, such as the NewCombat 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:
  • unknown – Procedure may be invoked from a general category of scripts, as dictated by the "context" attribute (above).
  • finalize – Procedure may only be called from within a Finalize Script.
  • calculate – Procedure may only be called from within a Calculate Script.
  • bounds – Procedure may only be called from within a Bound Script.
  • eval – Procedure may only be called from within an Eval Script.
  • evalrule – Procedure may only be called from within an EvalRule Script.
  • mouseinfo – Procedure may only be called from within a MouseInfo Script.
  • titlebar – Procedure may only be called from within a TitleBar Script.
  • description – Procedure may only be called from within a Description Script.
  • trigger – Procedure may only be called from within a Trigger Script.
  • label – Procedure may only be called from within a Label Script.
  • validate – Procedure may only be called from within a Validate Script.
  • xactsetup – Procedure may only be called from within a TransactSetup Script.
  • xactbuy – Procedure may only be called from within a TransactBuy Script.
  • xactsell – Procedure may only be called from within a TransactSell Script.
  • newcombat – Procedure may only be called from within a NewCombat Script.
  • endcombat – Procedure may only be called from within an EndCombat Script.
  • newturn – Procedure may only be called from within a NewTurn Script.
  • integrate – Procedure may only be called from within an Integrate Script.
  • synthesize – Procedure may only be called from within a Synthesize Script.
  • change– Procedure may only be called from within a Change Script.
  • none – Procedure may be called from any type of script. However, there is no initial context for identifiers, so no context transitions may be specified that don't explicitly designate a safe initial context (e.g. "hero."). This procedure type is useful when all inputs can be passed via variables and all results returned via variables.
  • Default: "unknown".

NOTE! It is valid to setup a focus pick via "setfocus" within a calling script and then utilize the inherited focus pick within a procedure of type "none".

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.

<procedure id="MyProc" context="info">
  ~insert script code here
  </procedure>

<procedure id="MyProc" scripttype="eval">
  ~insert script code here
  </procedure>