Difference between revisions of "RegisterHookFunction"

From The Official Visionaire Studio: Adventure Game Engine Wiki
m
Line 1: Line 1:
<div class="toccolours mw-collapsible mw-collapsed" style="background: #f0f0f0; border: 1px dashed darkgrey" width="100%">
+
==registerHookFunction==
<b>Command History</b>
 
<div class="mw-collapsible-content">
 
<div style="background:#ebebeb" width="100%">Available since <span style="color:orange">v3.7</span></div>
 
</div></div>
 
  
 +
<div class="command-min-version-info">Available since: <span class="command-min-version">v3.0</span></div>
  
Registers a hook function for a specific operation!
+
<div class="command-doc">Registers a hook function for a specific operation.</div>
  
 
+
Lua Syntax:
Syntax:
+
<pre class="command-syntax">registerHookFunction(hook, hookFunction)</pre>
<syntaxhighlight>
+
===Arguments===
registerHookFunction(hook, hookFunction)
+
====hook====
</syntaxhighlight>
+
:'''"string"''' - The operation for which the hook function should be called. Currently supported hooks: "setTextPosition" (the hook is called everytime the position of a displayed text is set), "getActionText" (the hook is called everytime to get the currently displayed action text).
 
+
====hookFunction====
 
+
:'''"string"''' - The name of the lua function which is called when the hook is executed. "setTextPosition": The function should take exactly one argument which is the affected visionaire object. The function must return a boolean value: true if the operation was handled in the hook function, false if the operation was not handled and should be handled by the engine (as if there were no hook).
Example:
+
:"getActionText": The function should take exactly one argument which is the current mouse position (a table containing x- and y-position). The function must return a string value which will be used as the current action text.
<syntaxhighlight>
+
===Flags===
n/a
+
===Return Values===
</syntaxhighlight>
+
None.
 
+
===Examples===
 
+
None.
 
 
<b><u>Arguments</u></b>
 
 
 
hook: "string" <br/>
 
The operation for which the hook function should be called!
 
* "setTextPosition" (the hook is called every time the position of a displayed text is set)
 
* "getActionText" (the hook is called every time to get the currently displayed action text)
 
 
 
 
 
hookFunction: "string" <br/>
 
The name of the lua function which is called when the hook is executed!
 
* "setTextPosition": The function should take exactly one argument which is the affected visionaire object. The function must return a boolean value: true if the operation was handled in the hook function, false if the operation was not handled and should be handled by the engine (as if there were no hook)
 
*"getActionText": The function should take exactly one argument which is the current mouse position (a table containing the 'absolute' x and y position). The function must return a string value which will be used as the current action text!
 
 
 
 
 
Flags: none
 
 
 
Return: none
 
{{i18n|StopAnimation}}
 

Revision as of 18:12, 22 November 2013

registerHookFunction

Available since: v3.0
Registers a hook function for a specific operation.

Lua Syntax:

registerHookFunction(hook, hookFunction)

Arguments

hook

"string" - The operation for which the hook function should be called. Currently supported hooks: "setTextPosition" (the hook is called everytime the position of a displayed text is set), "getActionText" (the hook is called everytime to get the currently displayed action text).

hookFunction

"string" - The name of the lua function which is called when the hook is executed. "setTextPosition": The function should take exactly one argument which is the affected visionaire object. The function must return a boolean value: true if the operation was handled in the hook function, false if the operation was not handled and should be handled by the engine (as if there were no hook).
"getActionText": The function should take exactly one argument which is the current mouse position (a table containing x- and y-position). The function must return a string value which will be used as the current action text.

Flags

Return Values

None.

Examples

None.