Besides the globalDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/AresChat/sb0t/llms.txt
Use this file to discover all available pages before exploring further.
onTimer event handler — which fires once every second for every loaded script — sb0t provides a constructable Timer object that lets you run a JavaScript callback on a custom interval. Each Timer instance fires independently, making it easy to schedule multiple tasks at different rates without cluttering onTimer with manual counter logic.
The global
onTimer event fires every second regardless of whether you use Timer instances. Use Timer for less frequent events, for multiple independent intervals, or when you want to decouple timing logic into a cleaner callback-based structure.Creating a Timer
Usenew Timer() to create a timer instance. After creation, set the interval (in milliseconds) and an oncomplete callback, then call start() to activate it.
t.start() again from inside the callback.
Timer Instance Properties
The interval in milliseconds between the call to
start() and when oncomplete is invoked. The minimum enforced value is 500 ms — any value below 500 is silently clamped to 500.Defaults to 1000 ms.The callback function to invoke when the interval elapses. Set this before calling
start().The callback receives no arguments and is called in the context of the script engine’s global object.Timer Instance Methods
timer.start()
Adds this timer to the active timer list and records the current server tick as the start time. The callback will fire after interval milliseconds have elapsed.
Returns: boolean — true if the timer was added successfully, false if it was already in the active list.
timer.stop()
Removes this timer from the active list. The oncomplete callback will not be called again unless start() is called again.
Returns: boolean — true if the timer was found and removed, false if it was not active.
Lifecycle and Cleanup
When a script is unloaded, all timers belonging to that script are automatically removed from the active list byTimerList.RemoveScriptTimers(). You do not need to manually stop timers in a cleanup handler — but doing so is good practice if you want to cancel them earlier.
Timers are matched to their owning script by the script name stored at construction time. If the owning script is no longer loaded when a timer fires, the callback is silently skipped.