- User can use 'action:call "my_add"' in event sheet to execute this js function
3. The 'my_add' function has a input parameter named "fn". It is the same as 'fn' at previous.
- 'fn.param' is to get the value set by 'action: set parameter'
- 'fn.result' is to set the value got by Function.Result.
- 'fn.CallFn(name, param0, param1)' can call any function defined in this function plugin, even in event sheet. In this example, it will call 'message' which is defined at event sheet to append some text at text object. Oh, it can return the value set by 'action: set Result'.
This feature can not let you control every objects in javascript. User can use javascript as game logic, and call 'fn.CallFn' to interact with other objects, or get some values from event sheet.
The API of internal function object (using in JS) are listed below.
A. set parameters, returns
:: input parameters, a hash
:: return values ,a hash
:: return value, single value
B. call function
- fn.CallFn(name, param0, param1...)
C. inject javascript function
Additional:
When the name of javascript function is the same as the function defined in event sheet, the function plugin will execute javascript function first, then the event sheet one.
If the javascript function return true, function plugin will not continue to execute the event sheet one. You can use this trick to do some checking/preprocessing before running the function defined in event sheet.