SetTimerEx

Set a callback event that will be invoked after a specified time delay

Function

void SetTimerEx(timerID: integer, delay: integer, callback: object, param: object);

Parameters

Name Type Description
timerID Integer An identifier that will distinguish this time from another. This value is passed into the callback function as a parameter. It is also used to stop the timer prior to callback (see KillTimer)
delay Integer This is the delay in milliseconds that will elapse before the callback is invoked. The context of this delay value is simulation time, so time warping will apply.
callback Object Can be a string (The name of the function) or the function that will be invoked when the specified time delay has expired.
param Object An object that is to be used within the callback method. This object may be any type or null.

Return Value

None

Example

Example 1

SetTimerEx(1, 1000, "CallMeWhenTimerExpires", GetComponentByNameAndType("CC1", "Conveyor") );

function CallMeWhenTimerExpires(timerId, object) {
    LogDebug("Timer " + timerId + " expires for " + object.Name);
}

Example 2

SetTimerEx(1, 1000,Test, GetComponentByNameAndType("CC1", "Conveyor"));

function Test (timerId, object){
    LogDebug("Timer " + timerId + " expires for " + object.Name);
}