SetTimerEx: Difference between revisions

From NPC for VCMP 0.4 Servers
Jump to navigation Jump to search
No edit summary
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 2: Line 2:
desc=This will create set a timer, which will be triggered when the given time has passed.|
desc=This will create set a timer, which will be triggered when the given time has passed.|
params=<syntaxhighlight lang="lua">(FunctionName, interval, n, ...)</syntaxhighlight>
params=<syntaxhighlight lang="lua">(FunctionName, interval, n, ...)</syntaxhighlight>
<poem>::FunctionName : The name of the function to be called.
<poem>::FunctionName[string] : The name of the function to be called.
::interval : The amount of time (in milliseconds) after which the function will be called.
::interval[integer] : The amount of time (in milliseconds) after which the function will be called.
::n : The number of times the function is to be called. Specify 0 to call the function infinite number of times.
::n[integer] : The number of times the function is to be called. Specify 0 to call the function infinite number of times.
::... : Optional Parameters to pass to the function. Supported parameter data types are integers, floats and strings.</poem>|
::... : Optional Parameters to pass to the function. Supported parameter data types are integers, floats and strings.</poem>|
retvals=The ID of the timer created, which can be used with [[KillTimer]]|
retvals=The ID of the timer created, which can be used with [[KillTimer]]. On failure it throws error and returns (null?) |
note=Unlike the usual timer function in squirrel gamemode, this function has third parameter 1 or 0. If you pass 1, the timer will repeat indefinitely rather than execute one time. Pass 0 to execute timer '''one time''' only.|note=This was added in 0.1b and will not work in first version.|
note=Unlike the usual timer function in squirrel gamemode, this function has third parameter 1 or 0. If you pass 1, the timer will repeat indefinitely rather than execute one time. Pass 0 to execute timer '''one time''' only.|note=This was added in v2.0 and will not work in previous builds.|
relfuncs=*[[KillTimer]]
relfuncs=*[[KillTimer]]
*[[SetTimer]]
*[[SetTimer]]
}}
}}

Latest revision as of 18:58, 26 November 2022


Description:
This will create set a timer, which will be triggered when the given time has passed.


Parameters:

(FunctionName, interval, n, ...)

FunctionName[string] : The name of the function to be called.
interval[integer] : The amount of time (in milliseconds) after which the function will be called.
n[integer] : The number of times the function is to be called. Specify 0 to call the function infinite number of times.
... : Optional Parameters to pass to the function. Supported parameter data types are integers, floats and strings.


Return Values:
The ID of the timer created, which can be used with KillTimer. On failure it throws error and returns (null?)

Important Note:
This was added in v2.0 and will not work in previous builds.


Related Functions

The following functions may be helpful as they relate to this function in one way or another.