Timer Advert Script

By [Plornt] on Oct 13, 2010

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 
      }
    }
  }
}

Comments

Sign in to comment.
WeirdThall   -  Oct 03, 2013

NVM its done now.
Sorry to necro an old script but it works great and wanted to add Ops use only? Where does that go into the code?

Kaj  -  Oct 04, 2013

With this syntax you can check if someone is op (look line 48 in the code)

if ($nick($chan,$nick,@&~)) {
Rest of the code
}
Blood_Wolf89  -  Mar 31, 2015

Or you can do this
if ($nick isop $chan) {
Rest of the code
}

Sign in to comment

troll   -  May 10, 2011

Nice

 Respond  
[Plornt]   -  Feb 24, 2011

Aha, sorry made this a while back ^^.
I could theoretically wild card it correct?

 Respond  
Jethro   -  Feb 21, 2011

I've realized a critical matter with this snippet. For the quit and nick event, the $chan doesn't exist and it'll only return $null.

 Respond  
Jnrda148   -  Feb 21, 2011

zelic at a guess by removing

[Advert][,$2,]

from line 6

and gotta love how you say this is easily editable plornt ,what for about us n00bs :D

 Respond  
zelic   -  Feb 16, 2011

Really nice, needed this. But is there a way to change it so it doesnt say [ADVERT][NICK] in the msg?

[12:58] [ADVERT][MyNick] Channel message!

 Respond  
chistel   -  Feb 07, 2011

nice, bt i dnt realy understand it

 Respond  
Jethro   -  Oct 19, 2010

Bielie, everyone's level of scripting knowledge is different. While it's commendable to share our ways of doing something, and as easier as you think it is, it may not seem so to others.

 Respond  
[Plornt]   -  Oct 19, 2010

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 |

 Respond  
Bielie   -  Oct 19, 2010

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 ] ] ) }
}
 Respond  
bourneident   -  Oct 14, 2010

I mean like !timer 45 blah blah something like that

 Respond  
[Plornt]   -  Oct 14, 2010

Actually they are in there... Line 7, the 900 is the time in seconds.

 Respond  
bourneident   -  Oct 14, 2010

very nice work any chance of a few more feature such as customizable times 15 30 60 ect.

 Respond  
Massivity   -  Oct 14, 2010

awesome scripy 10/10

 Respond  
Quick   -  Oct 13, 2010

10 from me mate I've been needing this for a good while and works very nice.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.