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:< | |(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).< | <ul class="sets"> | ||
pick – Procedure can be called from any script with a pick as its initial context.< | <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.< | <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 [[ | <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> | |||
info – Procedure can be called from any information synthesis script for a thing or pick, such as the [[MouseInfo Script]].< | <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]].< | <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]].< | <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:< | |(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).< | <ul class="sets"> | ||
finalize – Procedure may only be called from within a [[Finalize Script]].< | <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]].< | <li>finalize – Procedure may only be called from within a [[Finalize Script]].</li> | ||
bounds – Procedure may only be called from within a [[Bound Script]].< | <li>calculate – Procedure may only be called from within a [[Calculate Script]].</li> | ||
eval – Procedure may only be called from within an [[Eval Script]].< | <li>bounds – Procedure may only be called from within a [[Bound Script]].</li> | ||
evalrule – Procedure may only be called from within an [[EvalRule Script]].< | <li>eval – Procedure may only be called from within an [[Eval Script]].</li> | ||
mouseinfo – Procedure may only be called from within a [[MouseInfo Script]].< | <li>evalrule – Procedure may only be called from within an [[EvalRule Script]].</li> | ||
titlebar – Procedure may only be called from within a [[ | <li>mouseinfo – Procedure may only be called from within a [[MouseInfo Script]].</li> | ||
description – Procedure may only be called from within a [[Description Script]].< | <li>titlebar – Procedure may only be called from within a [[TitleBar Script]].</li> | ||
trigger – Procedure may only be called from within a [[Trigger Script]].< | <li>description – Procedure may only be called from within a [[Description Script]].</li> | ||
label – Procedure may only be called from within a [[Label Script]].< | <li>trigger – Procedure may only be called from within a [[Trigger Script]].</li> | ||
validate – Procedure may only be called from within a [[Validate Script]].< | <li>label – Procedure may only be called from within a [[Label Script]].</li> | ||
xactsetup – Procedure may only be called from within a [[TransactSetup Script]].< | <li>validate – Procedure may only be called from within a [[Validate Script]].</li> | ||
xactbuy – Procedure may only be called from within a [[TransactBuy Script]].< | <li>xactsetup – Procedure may only be called from within a [[TransactSetup Script]].</li> | ||
xactsell – Procedure may only be called from within a [[TransactSell Script]].< | <li>xactbuy – Procedure may only be called from within a [[TransactBuy Script]].</li> | ||
newcombat – Procedure may only be called from within a [[NewCombat Script]].< | <li>xactsell – Procedure may only be called from within a [[TransactSell Script]].</li> | ||
newturn – Procedure may only be called from within a [[NewTurn Script]].< | <li>newcombat – Procedure may only be called from within a [[NewCombat Script]].</li> | ||
integrate – Procedure may only be called from within an [[Integrate Script]].< | <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> | |||
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 | <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 … 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 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>