This is a small easilly editable script which can rotate user's adverts in the channel and will rename them if they chhange there nick and will also turn off if they leave or disconnect.
The t.set alias allows you to edit the text it says and the theme alias allows you to change the colour of the text.
Commands
!timer on
!timer off [nick] (Nick is ops only)
Thanks to steel on Torn IRC who helped test :P
alias theme return 3
alias t.set {
;; 4 is time in seconds
if ($1 == 1) return $+($theme,Your timer will now be run every4 15 minutes ,$theme,infinate times until you disconnect or leave.)
elseif ($1 == 2) return $+($theme,,$nick,,$chr(44) you already have a timer running. Type !timer off to remove your timer.)
elseif ($1 == 3) return $+($theme,[Advert][,$2,] $3-)
elseif ($1 == 4) return 900
elseif ($1 == 5) return $+($theme,Your timer has been removed from the rotation.)
elseif ($1 == 6) return $+($theme,$2 $+ 's timer has been removed from the rotation.)
}
on *:NICK:{
if ($timer($+(.,$nick.,$chan,.advert)).secs) {
timer $+ $+(.,$nick,.,$chan,.advert) off
var %com $left($gettok($timer($+(.,$nick.,$chan,.advert)).com,3-,44),$calc($len($gettok($timer($+(.,$nick.,$chan,.advert)).com,3-,44)) - 1))
.timer $+ $+(.,$newnick,.,$chan,.advert) 0 $v1 msg $chan $+($,t.set,$chr(40),3,$chr(44),$newnick,$chr(44),%com,$chr(41))
}
}
on *:PART:#:{
if ($timer($+(.,$nick.,$chan,.advert)).secs) {
.timer $+ $+(.,$nick,.,$chan,.advert) off
}
}
on *:QUIT:{
if ($timer($+(.,$nick.,$chan,.advert)).secs) {
.timer $+ $+(.,$nick,.,$chan,.advert) off
}
}
on *:TEXT:*:#:{
if ($1 == !timer) {
if ($2 == on) {
if (!$timer($+(.,$nick.,$chan,.advert)).secs) {
notice $nick $t.set(1)
msg $chan $t.set(3,$nick,$3-)
.timer $+ $+(.,$nick,.,$chan,.advert) 0 $t.set(4) msg $chan $+($,t.set,$chr(40),3,$chr(44),$nick,$chr(44),$3-,$chr(41))
}
else {
msg $chan $t.set(2)
}
}
elseif ($2 == off) {
if (!$3) {
msg $chan $t.set(5)
.timer $+ $+(.,$nick,.,$chan,.advert) off
}
elseif ($3 && $nick($chan,$nick,@&~)) {
msg $chan $t.set(6,$3)
.timer $+ $+(.,$3,.,$chan,.advert) off
}
}
}
}
Its not that.
For example, any user can have there own timer, meaning I can make on advertising on a games IRC that I have an item to sell and if the users nick changes, it changes the whole timer, and also cancels it when they leave/part.
Which leads me to my next point... Ive got to add some sort of removing of $ and |
Isnt it a bit easier to use it like this?
setteble timers in seconds. All you have to do is make a script that sets a variable with the info. (%event)
on $*:text:/^[!.@]eventspam/Si:#:{
if ($nick !isop $chan) { halt }
elseif ($2- == $null) { notice $nick Please use the correct syntax: !eventspam on/off <Delay in seconds> }
elseif ($2 == off) { notice $nick The eventspam option is now turned 4OFF1. | $+(timer,$chan) off }
elseif ($3 == $null) { notice $nick Please use the correct syntax: !eventspam on/off <Delay in seconds> }
elseif ($2 == on) && ($3 != $null) { notice $nick The eventspam option has been turned 4ON5 for channel $chan 10(The message will repeat every $3- seconds!) | $+(timer,$chan) 0 $3 /msg $chan 5The current event for $chan is:12 ( %event [ $+ [ $chan ] ] ) }
}
With this syntax you can check if someone is op (look line 48 in the code)