This plugin provides a mechanism for executing commands or typing text into a window after a time delay. It exists primarily to support other commands and plugins, such as the Auto-Unban feature, but you can use it to manually enter a delayed command, or to modify the behavior of the delayed commands set up by other plugins.
/delay
/delay [qadd] [qexec] timevalue command-string
/delay #nn[,nn...][-nn] newtimevalue
/delay #nn[,nn...][-nn] cancel
This command creates, deletes, displays, or modifies delayed commands. Any number of delayed commands can be pending at once. Each delayed command is assigned a sequence number when it is created, and you can later cancel or adjust the time of a delayed command by referencing its sequence number.
Entering the command with no parameters shows all pending delayed commands. The list of delayed commands is displayed in order of pending execution, not by the numeric sequence numbers.
Entering a timevalue followed by a command-string will add a new pending delayed command. The command will execute after the amount of time specified, as if you had typed it in the channel where the /delay command is entered. You can also use this to say something in the channel after a delay, by just typing some words that don't start with a /command. Whenever a new delayed command is set up, it gets a sequence number so that you can manipulate or cancel the command before it runs. Multiple commands can be executed at once by putting \n between each one in the command-string.
If you include the optional qadd parameter (quiet add), it suppresses the usual display of the command being added. This is mainly for use by other plugins which want to schedule delayed commands.
If you include the optional qexec parameter (quiet exec), it suppresses the usual display of the command when the command executes. This is mainly for use by other plugins which want to schedule delayed commands.
Entering a #nn sequence number followed by a timevalue will adjust the time for the pending command.
Entering a #nn sequence number followed by the word cancel will cancel the delayed command and remove it completely from the pending list. (Note to self: the syntax for cancel really should be /delay -#nn to be consistant with all other hipscript commands that work on lists of things.)
You can apply the same time adjustment (or cancel) to a series or numerical range of pending commands by using commas and dashes. For example:
/delay #2,7,9-12,14 .0
Will apply the .0 (run it right now) adjustment to commands 2, 7, 9,10,11,12,14.
A timevalue is an amount of time expressed as [@][.][[hh:]mm:]ss. The '@' makes the time relative to midnight, the '.' (dot) makes the time relative to right now. When entering a new delayed command, the default is for the time to be relative to right now. When adjusting an existing command, the default is for the new time value to be relative to the existing time value. In both cases, the default basis can be overridden by starting the time value with '@' or '.' as needed. Here are some examples:
20 - Twenty seconds
200 - Two hundred seconds
-20 - Minus twenty seconds
2:00 - Two minutes
-1:30:30 - Minus 1 hour 30 minutes 30 seconds
@22:00:00 - At 22:00 (10pm) tonight
@10:00:00PM - At 10pm tonight.
.+1:00 - One minute from now (when adjusting time on existing command)
The commands to be executed can include IRC commands, ircle commands, hipscript commands, and hipscript aliases you have defined.
If you unload or reload hipScript, or quit ircle, you lose all pending delayed commands. If you leave a channel and there are delayed commands pending for that channel, they'll most likely fail when the time comes to run them. (But if you leave and rejoin before they execute, that's fine.)
To stop ignoring someone 5 minutes from now:
/delay 5:00 /ignore -someone
To say goodbye and leave the channel at 7:30pm today:
/delay @7:30:00PM Well, I've got to go, see ya later.\n/part
To adjust the time on pending commands:
/delay #3 -2:00 -- make command #3 run 2 minutes earlier
/delay #22 1:00:00 -- make command #22 run 1 hour later
/delay #5 .+1:00 -- make command #5 run 1 minute from now.
/delay #12 .0 -- make command #12 run immediately.
If the result of changing the time sets the time into the past, the command executes immediately.
The hipscript /echo command can be used to display text locally without sending it to a channel. You can use this to create a reminder for yourself, such as:
/delay 10:00 /echo It's been 10 minutes, time to let the dogs back in!
You can use a combination of an alias and the /delay command to set up a repeating command. For example:
/alias annoy This is an annoying message\n/delay 5:00 /annoy
If you were to do this in a channel where I had op privs, you'd be kickbanned for sure; use this technique at your own risk. (Of course, you may think of non-annoying useful things to do with this basic technique, which is why I mention it.)
Aliases can make adjusting existing commands easier:
/alias dcan /delay #$1 cancel - /dcan 3 would cancel command #3
/alias now /delay #$1 .0 - /now 7 would make command #7 run now
/alias d5 /delay #$1 +5:00 - /d5 2 would add 5 minutes to command #2