12.1 Timers
You can also make your script execute something after a certain number of minutes or seconds.
This can be done with the timer and utimer commands.
The syntax of a timer command is timer <time> "<command> [parameters]".
The <time> is after how long your command should be executed.
If you are using timer this would be have to be in minutes and if you are using utimer this
would have to be in seconds.
The <command> is the command you want to execute.
This can be a TCL command, an Eggdrop command or anything else just as long as it's a valid command.
The [parameters] are the parameters you want to give to your command.
With the commands timers and utimers you can see a list of the timers that are currently
active. These commands do not need any parameters and return a list of which each object contains information
about one of the timers that is currently running.
Note that timers are so called evaluated which means that if you have $foo that contains for instance "[foo]"
and than call the timer with utimer 30 "test $foo" it would try to execute the command "foo" since it's
enclosed in brackets and send the output of the command "foo" to the command as a parameter instead of what the
string contains.
So be extra carefull when you are using timers and escape any brackets in your strings with a command like
list or by putting backslashes in front of the brackets in the string itself like this:
set foo "\\\[foo\\\]" which would result in $foo containing "\[foo\]".
Because of this evaluation it is best to keep the syntax of the timer commands as timer <time>
[list <command> <parameters>]" when you are sending parameters to the procedure to prevent any errors from
occuring, better safe than sound.
|