Difference between revisions of "RegisterHookFunction"

From The Official Visionaire Studio: Adventure Game Engine Wiki
(Created page with "<div class="toccolours mw-collapsible mw-collapsed" style="background: #f0f0f0; border: 1px dashed darkgrey" width="100%"> <b>Command History</b> <div class="mw-collapsible-co...")
 
Line 28: Line 28:
 
* "setTextPosition" (the hook is called every time the position of a displayed text is set)
 
* "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)
 
* "getActionText" (the hook is called every time to get the currently displayed action text)
 +
  
 
hookFunction: "string" <br/>
 
hookFunction: "string" <br/>
Line 33: Line 34:
 
* "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)
 
* "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!
 
*"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: none
 
Flags: none

Revision as of 19:38, 7 March 2013

Command History

Available since v3.7


Registers a hook function for a specific operation!


Syntax:

registerHookFunction(hook, hookFunction)


Example 1: basic stop animation method

n/a


Arguments

hook: "string"
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"
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: none

Return: none