Timers allow you to execute commands repeatedly at fixed intervals, and also to specify a command to be executed later.
Timers have to mandatory attributes: an interval in seconds, that represents how often the timer is fired, and an action, that is the command that is executed. Just like in other places, the action can be a text that is sent to the MUD, or it can be something run with Perl.
It is possible to define timers that execute only a fixed number of times. This is the timer's repeat count. Whenever the timer is executed, this count is decreased, and when it reaches zero, the timer is disabled, and will only execute again if reenabled manually. A timer can also be temporary: in this case, when the repeat count reaches zero, it is deleted and not only disabled. A repeat count of -1 means that the timer is executed indefinitely.
A timer with a repeat count of one is executed only once. Since the first execution only happens interval seconds after it is defined, this allows you to define a command to be executed after some specified time. If it is marked as temporary, the timer will be deleted after it is run this one time.
The easiest way to create and alter timers is from the World Editor, the place where all settings of a World are altered (see Chapter 4).
Timer are defined in the Timers section inside the Automation section. When you open that section, you'll see a list of the defined timers and some buttons like this:
The main part of the window is the list of defined timers. The columns are as follows:
Enabled specifies whether the timer is enabled or not. Timers that are not enabled are not active and will not be run, but they remain in the list so that they can later be enabled again.
Name is a name that is assigned to a timer. This helps you identify the timer's purpose and is useful when editing a timer via the command line (as described in Section 11.2.1). Assigning a name to a timer is optional.
Interval is the interval between timer activations, as described above.
Count is the repeat count, as described above.
Action is the action that is run when the timer fires.
Temp indicates whether the timer is temporary or not. Temporary timers are deleted automatically when their repeat count reaches 0.
Plugin: if this is non-empty, it means that the timer belongs to a plugin (and the name of the plugin is displayed). However, by default plugin timers are not displayed. See Section 4.7 for information on how to display plugin timers here.
To add a new timer, press the Add button. This will open a window for you to edit the new timer's parameters:
What can be set represents the columns described above.
When you are finished, press OK and the timer will be added. If you change your mind, press Cancel and the timer will not be added.
To see some things timers can do, read Section 11.2. If you want to try the timers described there, you can create them from the World Editor.
To edit a timer, select it by clicking its line in the list (the line will be highlighted), and press the Edit button. A window like the one used for adding timer (see Section 11.1.1) will be opened, filled with the timer's parameters. Change what you want, and press the OK to commit the changes. If, however, you change you mind, press Cancel and the changes will be not be made, the timer will remain as it was before.
Another shorter way to edit a timer is to double click its line in the list.
It is also possible to change the value of the binary options (those represented by a check box) directly from the timer list. Make sure that the timer you want to change is selected, and click in the check button. The state will be toggled.
To delete a timer, select it and press the Delete button. You will be asked for confirmation, and can cancel the operation, but once deleted, you cannot recover the timer. If you want, you can disable this confirmation dialog, but if you do so and click the Delete button, the only way to undo your action will be creating the timer again. See Section 4.7. To delete several timers at once, select them all and press Delete.
The final thing that needs to be explained with regard to timers is how to reorder them. Timers as tried from the first one to the last, so in a few cases the order might matter. To move a timer up or down in the list, select it and press the corresponding button.