Timers
Timers let you set up periodic events (eg. every 10 seconds) or things that happen at a particular time (eg. 10:30 a.m.)

Timers can be once-off, which means they fire once and then delete themselves. This is useful if you only need to do the timed event once. (eg. cast a spell in 10 seconds).

Alternatively, timers can fire indefinitely, so you might, for example, eat food every 10 minutes.

Timers can send text to the MUD, make a note in the output window, invoke a script, do a speedwalk, or many other things.

You can have any number of timers, per world.

Granularity of timers

Note that the "granularity" of the timers is controlled by the "timers" tab in the "Preferences" menu item under the File menu.

What this means is that the interval set there (eg. 5 seconds) is the rate at which timers are tested to see if they have fired. If you want timers to be accurate to the nearest second, then the timer granularity must be set at 1 second. If having a timer fire to the nearest 5 seconds is satisfactory for you, then set the granularity to 5 seconds. Setting a smaller granularity improves the accuracy of timers, but may slow the program down slightly, particularly on slower PCs.

You can have timers tested every 10th of a second by setting the granularity to zero in the global preferences. This allows for finer resolution of timers than was previously possible.




Timer scripts

Timers can execute script commands by simply putting the command into the "send" box and selecting "send to script".

However for more complex scripts you can put scripts into your script file (see scripting configuration tab for the world) and then call the script from the timer. To do this put the name of the script subroutine into the alias's script box.

The script subroutine must have one argument which is the name of the timer.

An example script in the VBscript language would be:


sub MyTimer (name)
  world.Note "Timer " & name & " fired."
end sub



See Also ...

Topics

DOC_aliases Aliases
DOC_defaults Default triggers/aliases/timers/macros/colours
DOC_starting Getting started
DOC_group Groups
DOC_plugins Plugins
DOC_triggers Triggers

Command

CMD_ID_GAME_CONFIGURE_TIMERS ConfigureTimers (Define timers)

Dialogs

DLG_IDD_EDIT_TIMER Edit timer
DLG_IDD_PREFS_P16 Timers

Functions

FNC_AddTimer AddTimer (Adds a timer)
FNC_DeleteTemporaryTimers DeleteTemporaryTimers (Deletes all temporary timers)
FNC_DeleteTimer DeleteTimer (Deletes a timer)
FNC_DeleteTimerGroup DeleteTimerGroup (Deletes a group of timers)
FNC_DoAfter DoAfter (Adds a one-shot, temporary timer - simplified interface)
FNC_DoAfterSpecial DoAfterSpecial (Adds a one-shot, temporary, timer to carry out some special action)
FNC_DoAfterSpeedWalk DoAfterSpeedWalk (Adds a one-shot, temporary speedwalk timer - simplified interface)
FNC_EnableTimer EnableTimer (Enables or disables an timer)
FNC_EnableTimerGroup EnableTimerGroup (Enables/disables a group of timers)
FNC_GetTimer GetTimer (Gets details about a timer)
FNC_GetTimerInfo GetTimerInfo (Gets details about a timer)
FNC_GetTimerList GetTimerList (Gets the list of timers)
FNC_GetTimerOption GetTimerOption (Gets the value of a named timer option)
FNC_IsTimer IsTimer (Tests to see if a timer exists)
FNC_ResetTimer ResetTimer (Resets a named timer)
FNC_ResetTimers ResetTimers (Resets all timers)
FNC_SetTimerOption SetTimerOption (Sets the value of a named timer option)

(Help topic: general=timers)

DOC_contents Documentation contents page