SetTimerOption
Script function

world.SetTimerOption

DOC_scripting Read about scripting

Type

Method

Summary

Sets the value of a named timer option

Prototype

long SetTimerOption(BSTR TimerName, BSTR OptionName, BSTR Value);

DOC_data_types View list of data type meanings


Description

Sets the current value of a timer option.

You must specify the name of an existing timer, and a timer option from the list given for GetTimerOption. These are the same names as used in the XML world files for timer options.

For a detailed description about the meanings of the fields, see AddTimer.

Note that you can neither get nor set the "name" field. It is listed below for completeness in viewing timers copied to the clipboard or in world files and plugins. You already know the name when getting the timer option (it is TimerName), and this function is provided to modify existing timers, not rename them. To change the name of a timer use ExportXML, modify the XML, and then ImportXML.

If SetTimerOption is called from within a plugin, the timers for the current plugin are used, not the "global" MUSHclient timers.

For numeric options (such as "hour") the supplied string will be converted to a number. It is an error if the string does not consist of digits (0 to 9). For the "user" option an optional leading sign is accepted.

For boolean options (such as "enabled") the supplied string must be "0" for false (n), or "1" for true (y). Boolean options are shown below as having a y/n value.

The various option names are:

"active_closed": y/n - timer is active when world closed
"at_time": y/n - y=fire *at* time of day, otherwise every interval
"enabled": y/n - timer is enabled
"group": (string - group name)
"hour": hour to fire at (or every hour)
"minute": minute to fire at (or every minute)
"name": (string - name/label of alias)
"offset_hour": offset hour - fire at time *plus* this
"offset_minute": offset minute - fire at time *plus* this
"offset_second": offset second - fire at time *plus* this
"omit_from_log": y/n - omit timer from log file
"omit_from_output": y/n - omit timer output from log file
"one_shot": y/n - delete after firing
"script": (string - name of function to call)
"second": hour to fire at (or every second)
"send": (multi-line string - what to send)
"send_to": 0 - 13 - "send to" location (see below)
"user": -2147483647 to 2147483647 - user-defined number
"variable": (string - name of variable to send to)

Send-to locations

"0" - send to MUD
"1" - put in command window
"2" - display in output window
"3" - put in status line
"4" - new notepad
"5" - append to notepad
"6" - put in log file
"7" - replace notepad
"8" - queue it
"9" - set a variable
"10" - re-parse as command
"11" - send to MUD as speedwalk
"12" - send to script engine
"13" - send without queuing
"14" - send to script engine - after omitting from output



VBscript example

world.SetTimerOption "mytimer", "minute", "5"



Jscript example

world.SetTimerOption ("mytimer", "minute", "5");



PerlScript example

$world->SetTimerOption ("mytimer", "minute", "5");



Python example

world.SetTimerOption ("mytimer", "minute", "5")



Lua example

SetTimerOption ("mytimer", "minute", "5")



Lua notes

The "send_to" field can be specified using the "sendto" table in the Lua global address space, as follows:

sendto.world = 0
sendto.command = 1
sendto.output = 2
sendto.status = 3
sendto.notepad = 4
sendto.notepadappend = 5
sendto.logfile = 6
sendto.notepadreplace = 7
sendto.commandqueue = 8
sendto.variable = 9
sendto.execute = 10
sendto.speedwalk = 11
sendto.script = 12
sendto.immediate = 13
sendto.scriptafteromit = 14



Return value

eInvalidObjectLabel: The timer name is not valid
eTimeInvalid: Time is out of range (hours not 0 to 23, minutes/seconds not 0-59)
eScriptNameNotLocated: The script name cannot be located in the script file
eBadRegularExpression: The regular expression could not be evaluated
eOK: set OK


DOC_errors View list of return code meanings


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_timers Timers
DOC_triggers Triggers

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_GetPluginTimerOption GetPluginTimerOption (Gets the value of a named timer option for a specified plugin)
FNC_GetPluginTriggerOption GetPluginTriggerOption (Gets the value of a named trigger option for a specified plugin)
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)

(Help topic: function=SetTimerOption)

DOC_contents Documentation contents page