SetTimer: Difference between revisions
No edit summary |
No edit summary |
||
Line 37: | Line 37: | ||
==See Also== | ==See Also== | ||
{{ | {{Utility functions}} |
Revision as of 20:26, 20 May 2006
This function allows you to trigger a function after a number of milliseconds have ellapsed. You can call either your own functions, or built in functions. For example, you could set a timer to spawn a player after a number of seconds had ellapsed.
Once a timer has called a function once, it no longer exists. To repeatedly call a function, have that function recreate the timer each time.
Syntax
bool setTimer ( string functionName, int time, [var argument1, ...] )
Required Arguments
- functionName: The name of the function you wish the timer to call.
- time: The number of milliseconds that should ellapse before the function is called. 1000 milliseconds = 1 second.
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.
- argument1: Any arguments you wish to pass to the function can be listed after the time variable.
Returns
Returns true if the timer was set succesfully, false if the arguments are invalid or the timer could not be set.
Example
'Example 1: This example will output some text after a number of seconds.
First we define a function that we wish to be called.
function delayedChat ( text ) outputChatBox ( "Delayed text: " .. text ) end
Then we can set a timer that will call it in 1 second (1000 milliseconds) time.
setTimer ( "delayedChat", 1000, "Hello, World!" )
1 second after the line above has been executed, the text Delayed text: Hello, World! will be displayed in the chat box.
See Also
- addDebugHook
- base64Decode
- base64Encode
- debugSleep
- decodeString
- encodeString
- fromJSON
- generateKeyPair
- getColorFromString
- getDevelopmentMode
- getDistanceBetweenPoints2D
- getDistanceBetweenPoints3D
- getEasingValue
- getNetworkStats
- getNetworkUsageData
- getPerformanceStats
- getRealTime
- getTickCount
- getTimerDetails
- getTimers
- getFPSLimit
- getUserdataType
- getVersion
- gettok
- isTransferBoxVisible
- setTransferBoxVisible
- hash
- inspect
- interpolateBetween
- iprint
- isOOPEnabled
- isTimer
- killTimer
- md5
- passwordHash
- passwordVerify
- pregFind
- pregMatch
- pregReplace
- removeDebugHook
- resetTimer
- setDevelopmentMode
- setFPSLimit
- setTimer
- ref
- deref
- sha256
- split
- teaDecode
- teaEncode
- toJSON
- tocolor
- getProcessMemoryStats
- utfChar
- utfCode
- utfLen
- utfSeek
- utfSub
- bitAnd
- bitNot
- bitOr
- bitXor
- bitTest
- bitLRotate
- bitRRotate
- bitLShift
- bitRShift
- bitArShift
- bitExtract
- bitReplace