FrameFunctions
Info
Dependencies:
- Floats
- PermMem
- HookEngine
- Timer
Implementation:
FrameFunctions.d on GitHub
The FrameFunctions package allows to call any number of functions called on every frame, or every specified time delay.
Initialization
Initialize with LeGo_FrameFunctions
flag.
Functions
FF_Apply
FF_Apply
Adds the Daedalus function function
to the running FrameFunctions list. function
is called each frame.
var func function
Name of the function
FF_ApplyGT
FF_ApplyGT
Adds the Daedalus function function
to the running FrameFunctions list. function
is called every frame except when the game is paused.
var func function
Name of the function
FF_ApplyData
FF_ApplyData
Adds the Daedalus function function
to the running FrameFunctions list. The integer parameter data
is passed to the function function
.
var func function
Name of the function.var int data
Value passed to the function as a parameter
FF_ApplyExt
FF_ApplyExt
Adds the Daedalus function function
to the running FrameFunctions list. The function function
is called every delay
milliseconds, and it runs only cycles
number of times.
var func function
Name of the functionvar int delay
Delay between calls in milliseconds (0 = every frame)var int cycles
How many times should the function be called (-1 = endless)
FF_ApplyExtGT
FF_ApplyExtGT
Adds the Daedalus function function
to the running FrameFunctions list. The function function
is called every delay
milliseconds, and it runs only cycles
number of times. Gets called only when the game is not paused.
var func function
Name of the functionvar int delay
Delay between calls in milliseconds (0 = every frame)var int cycles
How many times should the function be called (-1 = endless)
FF_ApplyExtData
FF_ApplyExtData
Adds the Daedalus function function
to the running FrameFunctions list. The function function
is called every delay
milliseconds, and it runs only cycles
number of times. The integer parameter data
is passed to the function function
.
var func function
Name of the function.var int delay
Delay between calls in milliseconds (0 = every frame)var int cycles
How many times should the function be called (-1 = endless)var int data
Value passed to the function as a parameter
FF_ApplyExtDataGT
FF_ApplyExtDataGT
Adds the Daedalus function function
to the running FrameFunctions list. The function function
is called every delay
milliseconds, and it runs only cycles
number of times. The integer parameter data
is passed to the function function
. Gets called only when the game is not paused.
var func function
Name of the function.var int delay
Delay between calls in milliseconds (0 = every frame)var int cycles
How many times should the function be called (-1 = endless)var int data
Value passed to the function as a parameter
FF_ApplyOnce
FF_ApplyOnce
Alias to FF_Apply, which only adds the function once, even after multiple calls.
var func function
Name of the function
FF_ApplyOnceGT
FF_ApplyOnceGT
Alias to FF_ApplyGT, which only adds the function once, even after multiple calls. Loop doesn't run if the game is paused.
var func function
Name of the function.
FF_ApplyOnceData
FF_ApplyOnceData
Alias to FF_ApplyData, which only adds the function with the specified parameter once, even after multiple calls.
var func function
Name of the function.var int data
Value passed to the function as a parameter
FF_ApplyOnceExt
FF_ApplyOnceExt
Alias to FF_ApplyExt, which adds the function only once, after repeated calls.
var func function
Name of the functionvar int delay
Delay between calls in milliseconds (0 = every frame)var int cycles
How many times should the function be called (-1 = endless)
FF_ApplyOnceExtGT
FF_ApplyOnceExtGT
Alias to FF_ApplyExtGT, which adds the function only once after repeated calls. Loop doesn't run if the game is paused.
var func function
Name of the functionvar int delay
Delay between calls in milliseconds (0 = every frame)var int cycles
How many times should the function be called (-1 = endless)
FF_ApplyOnceExtData
FF_ApplyOnceExtData
Alias to FF_ApplyExtData, which adds the function with the specified parameter only once, after repeated calls.
var func function
Name of the functionvar int delay
Delay between calls in milliseconds (0 = every frame)var int cycles
How many times should the function be called (-1 = endless)var int data
Value passed to the function as a parameter
FF_Active
FF_Active
Checks whether the function
is active.
var func function
Name of the function
Return value The function returns TRUE
if the function is active, FALSE
if it is not.
FF_ActiveData
FF_ActiveData
Checks whether the function
with the specified data
is active.
var func function
Name of the functionvar int data
Value previously passed to the function
Return value The function returns TRUE
if the function is active, FALSE
if it is not.
FF_Remove
FF_Remove
Stops a specific FrameFunction.
var func function
Name of the stopped function
FF_RemoveAll
FF_RemoveAll
Stops all intsnces of a specific FrameFunction.
var func function
Name of the stopped function
FF_RemoveData
FF_RemoveData
Stops a specific FrameFunction, with the specified value (see FF_ApplyExtData
).
var func function
Name of the stopped functionvar int data
Value previously passed to the function as a parameter
Examples
A function called every frame
In this example function MyFunc
will be executed on every frame.
Example1
function is executed the function MyFunc
is called on every frame. The easiest and best way to run a function from the beginning is to call FF-Apply
directly in the Init_Global
(under LeGo_Init
), there is a small problem: If the game is loaded, Init_Global
is called a second time, the function is added to the list again and is therefore always called twice.
To avoid this effect, you should check whether the function is already active:
However, since LeGo version 2.2 there is an even more pleasant method to do this:
FF_ApplyOnce
function already implements the check for function activity. Calling delayed function
Create a function, that is called once after 3 seconds.
There is also a Once
variant of this function, that prevents adding it twice into the frame function list.
Note
FF_ApplyExt(MyFunc, 0, -1)
is the same as FF_Apply(MyFunc)
.
FrameFunction with Timer
Since LeGo 2.2, FrameFunctions package uses the Timer package, so it is possible to pause FrameFunctions at will:
Warning
Because the timer doesn't run, the frame function execution is stopped as well. This script won't work. If the timer is to be paused, it must be paused outside FrameFunctions.
Note
This is translation of article originally written by Gottfried and Lehona and hosted on LeGo's official documentation website.