Procedure Element (Data): Difference between revisions

From HLKitWiki
Jump to navigationJump to search
No edit summary
 
(12 intermediate revisions by one other user not shown)
Line 10: Line 10:
|-
|-
|context
|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:<br>
|(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).<br>
<ul class="sets">
pick – Procedure can be called from any script with a pick as its initial context.<br>
<li>unknown – Procedure may only be invoked from within a specific type of script, as dictated by the "scripttype" attribute (below).</li>
container – Procedure can be called from any script with a container as its initial context.<br>
<li>pick – Procedure can be called from any script with a pick as its initial context.</li>
entity – Procedure can be called from entity-related scripts, such as the [[Titlebar Script]].<br>
<li>container – Procedure can be called from any script with a container as its initial context.</li>
visual – Procedure can be called from any visual script, such as the [[Position Script]].<br>
<li>entity – Procedure can be called from entity-related scripts, such as the [[TitleBar Script]].</li>
info – Procedure can be called from any information synthesis script for a thing or pick, such as the [[MouseInfo Script]].<br>
<li>info – Procedure can be called from any information synthesis script for a thing or pick, such as the [[MouseInfo Script]].</li>
transact – Procedure can be called from any transaction script, such as the [[TransactBuy Script]].<br>
<li>transact – Procedure can be called from any transaction script, such as the [[TransactBuy Script]].</li>
combat – Procedure can be called from any combat-related script, such as the [[NewCombat Script]].<br>
<li>combat – Procedure can be called from any combat-related script, such as the [[NewCombat Script]].</li>
Default: "unknown".
<li>Default: "unknown".</li>
</ul>
|-
|-
|scripttype
|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:<br>
|(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).<br>
<ul class="sets">
finalize – Procedure may only be called from within a [[Finalize Script]].<br>
<li>unknown – Procedure may be invoked from a general category of scripts, as dictated by the "context" attribute (above).</li>
calculate – Procedure may only be called from within a [[Calculate Script]].<br>
<li>finalize – Procedure may only be called from within a [[Finalize Script]].</li>
bounds – Procedure may only be called from within a [[Bound Script]].<br>
<li>calculate – Procedure may only be called from within a [[Calculate Script]].</li>
eval – Procedure may only be called from within an [[Eval Script]].<br>
<li>bounds – Procedure may only be called from within a [[Bound Script]].</li>
evalrule – Procedure may only be called from within an [[EvalRule Script]].<br>
<li>eval – Procedure may only be called from within an [[Eval Script]].</li>
mouseinfo – Procedure may only be called from within a [[MouseInfo Script]].<br>
<li>evalrule – Procedure may only be called from within an [[EvalRule Script]].</li>
titlebar – Procedure may only be called from within a [[Titlebar Script]].<br>
<li>mouseinfo – Procedure may only be called from within a [[MouseInfo Script]].</li>
description – Procedure may only be called from within a [[Description Script]].<br>
<li>titlebar – Procedure may only be called from within a [[TitleBar Script]].</li>
trigger – Procedure may only be called from within a [[Trigger Script]].<br>
<li>description – Procedure may only be called from within a [[Description Script]].</li>
label – Procedure may only be called from within a [[Label Script]].<br>
<li>trigger – Procedure may only be called from within a [[Trigger Script]].</li>
validate – Procedure may only be called from within a [[Validate Script]].<br>
<li>label – Procedure may only be called from within a [[Label Script]].</li>
xactsetup – Procedure may only be called from within a [[TransactSetup Script]].<br>
<li>validate – Procedure may only be called from within a [[Validate Script]].</li>
xactbuy – Procedure may only be called from within a [[TransactBuy Script]].<br>
<li>xactsetup – Procedure may only be called from within a [[TransactSetup Script]].</li>
xactsell – Procedure may only be called from within a [[TransactSell Script]].<br>
<li>xactbuy – Procedure may only be called from within a [[TransactBuy Script]].</li>
newcombat – Procedure may only be called from within a [[NewCombat Script]].<br>
<li>xactsell – Procedure may only be called from within a [[TransactSell Script]].</li>
newturn – Procedure may only be called from within a [[NewTurn Script]].<br>
<li>newcombat – Procedure may only be called from within a [[NewCombat Script]].</li>
integrate – Procedure may only be called from within an [[Integrate Script]].<br>
<li>endcombat – Procedure may only be called from within an [[EndCombat Script]].</li>
dossier – Procedure may only be called from within a [[Dossier Script]].<br>
<li>newturn – Procedure may only be called from within a [[NewTurn Script]].</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 are passed via variables and all results returned via variables. {{note}}It '''is''' valid to setup a focus pick via "setfocus" within a calling script and then utilize the inherited focus pick within this type of Default: "unknown".
<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>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>Default: "unknown".</li>
</ul>
{{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
|PCDATA

Latest revision as of 05:48, 20 December 2013

Context: HL Kit &#133; Kit Reference &#133; 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>