The function that will be invoked from C++. Single-use functions (similar to javascript setCallback) should simply return false.
Time in seconds to be used as the interval between invocations of the callback and the interval before the first callback. Negative timeoutSeconds has the same effect as 0. 0 timeoutSeconds will result in callback being triggered every frame.
OptionalcallbackId: numberPositive integer. If passed, will be used as the callbackId for this method. If an interval already exists with that Id, this new interval will replace the old interval. If not passed, the interval will generate it's own id to use. The interval's generated id is the number of previous intervals that have generated their id this login session. Generated id can overwrite callback functions at specified ids.
The callbackId of the function, which can be used in clearInterval.
function alarm ()
osrs.print("BEEP")
return true
end
function alarm2 ()
osrs.print("BOOP")
return true
end
-- This will cause BEEP be printed out every 2 seconds with an id of callback id of 0
alarmId = osrs.setInterval(alarm, 2, 0)
-- This will cause BOOP be printed out every 2 seconds with an id of callback id of 0, overwriting the previously established BEEP alarm
-- ( Please note this assumes no other intervals have been generated )
alarmId2 = osrs.setInterval(alarm2, 2)
-- Prints: 0
osrs.print(tostring(alarmId))
-- Prints: 0
osrs.print(tostring(alarmId2))
Sets a lua function to be called at a specified interval. The method is invoked indefinitely, until quit, log out, interval clear through clearInterval, or callback not returning true.