[Home] [Downloads] [Search] [Help/forum]

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

Aliases
Default triggers/aliases/timers/macros/colours
Getting started
Groups
Plugins
Triggers

Command

(ConfigureTimers) Define timers

Dialogs

Edit timer
Timers

Functions

(AddTimer) Adds a timer
(DeleteTemporaryTimers) Deletes all temporary timers
(DeleteTimer) Deletes a timer
(DeleteTimerGroup) Deletes a group of timers
(DoAfter) Adds a one-shot, temporary timer - simplified interface
(DoAfterSpecial) Adds a one-shot, temporary, timer to carry out some special action
(DoAfterSpeedWalk) Adds a one-shot, temporary speedwalk timer - simplified interface
(EnableTimer) Enables or disables an timer
(EnableTimerGroup) Enables/disables a group of timers
(GetPluginTimerOption) Gets the value of a named timer option for a specified plugin
(GetPluginTriggerOption) Gets the value of a named trigger option for a specified plugin
(GetTimer) Gets details about a timer
(GetTimerInfo) Gets details about a timer
(GetTimerList) Gets the list of timers
(GetTimerOption) Gets the value of a named timer option
(IsTimer) Tests to see if a timer exists
(ResetTimer) Resets a named timer
(ResetTimers) Resets all timers
(SetTimerOption) Sets the value of a named timer option

(Help topic: general=timers)

Documentation contents page


Search ...

Enter a search string to find matching documentation.

Search for:   

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]