Procedure Element (Data): Difference between revisions
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... |
No edit summary |
||
Line 23: | Line 23: | ||
|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:<br> | ||
unknown – Procedure may be invoked from a general category of scripts, as dictated by the "context" attribute (above).<br> | |||
procedure.<br> | |||
finalize – <br> | finalize – Procedure may only be called from within a [[Finalize Script]].<br> | ||
calculate – <br> | calculate – Procedure may only be called from within a [[Calculate Script]].<br> | ||
bounds – <br> | bounds – Procedure may only be called from within a [[Bound Script]].<br> | ||
eval – <br> | eval – Procedure may only be called from within an [[Eval Script]].<br> | ||
mouseinfo – <br> | evalrule – Procedure may only be called from within an [[EvalRule Script]].<br> | ||
titlebar – <br> | mouseinfo – Procedure may only be called from within a [[MouseInfo Script]].<br> | ||
description – <br> | titlebar – Procedure may only be called from within a [[Titlebar Script]].<br> | ||
trigger – <br> | description – Procedure may only be called from within a [[Description Script]].<br> | ||
label – <br> | trigger – Procedure may only be called from within a [[Trigger Script]].<br> | ||
label – Procedure may only be called from within a [[Label Script]].<br> | |||
validate – Procedure may only be called from within a [[Validate Script]].<br> | |||
xactsetup – <br> | xactsetup – Procedure may only be called from within a [[TransactSetup Script]].<br> | ||
xactbuy – <br> | xactbuy – Procedure may only be called from within a [[TransactBuy Script]].<br> | ||
xactsell – <br> | xactsell – Procedure may only be called from within a [[TransactSell Script]].<br> | ||
newcombat – <br> | newcombat – Procedure may only be called from within a [[NewCombat Script]].<br> | ||
newturn – <br> | newturn – Procedure may only be called from within a [[NewTurn Script]].<br> | ||
integrate – <br> | integrate – Procedure may only be called from within an [[Integrate Script]].<br> | ||
dossier – <br> | dossier – Procedure may only be called from within a [[Dossier Script]].<br> | ||
Default: " | 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". | ||
|- | |- | ||
|PCDATA | |PCDATA |
Revision as of 03:27, 1 December 2008
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 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:
unknown – Procedure may be invoked from a general category of scripts, as dictated by the "context" attribute (above).
procedure.
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.
newturn – Procedure may only be called from within a NewTurn Script.
integrate – Procedure may only be called from within an Integrate Script.
dossier – Procedure may only be called from within a Dossier 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 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".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.