An optional game object that will be passed in to your function when it gets called. The object will automatically be refreshed with the latest game data.
If the object gets destroyed, the associated queued call will be cancelled automatically.
3.1 Beta 1
#2
str
String
An optional string that will be passed in to your function when it gets called.
3.2
Return value
Value
Type
Description
Game version
undefined
Undefined
The function was successfully queued.
3.1 Beta 1
<error>
Error
Did you forget to specify functionName as a string?
3.1 Beta 1
Notes
Unlike setTimer(), queue() does not repeat. It will make a single call to the named function at a later frame in the game.
You can cancel a queued call by calling removeTimer() (will also remove any timers associated with the function).
The function, when called, will be run in the context of the global scope ("this" will be the global scope).
Queued function calls persist the save/load cycle. You can therefore look at Saved game files to see what queued functions were defined at the time the game was saved.
Examples
Syntax #1: Call a function next game tick, passing in a game object
function foo(gameObj) {
// gameObj == someGameObject
}
// this syntax works on WZ 3.1 and above
queue("foo", 0, someGameObject);
// global function foo will be called next game tick (100ms)
// if someGameObject gets destroyed, the queued call will be cancelled
Syntax #1: Call a function after 1 second, passing in a string
function bar(str) {
// str = "hello"
}
// this syntax requires WZ 3.2 or above
queue("bar", 1000, "hello");
// global function bar will be called after 1 second
Availability 3.1 B1+
Requires:
Warzone 3.1 Beta 1 and above
Syntax #2 added in Warzone 3.2
Contents
Jump to:
See also
Related functions:
setTimer() – similar to queue, but will repeatedly call the function at a defined interval
removeTimer() – cancels all timers associated with a function