Multiple Channel Greeting

By tv3636 on May 14, 2009

This is pretty simple but I don't think any of the other greeting scripts work quite the same way as this so I figured I'd fix it up a bit and post it.

This script allows you to have multiple greetings for multiple channels (as in, you can use this on as many channels as you want and have as many greetings as you want for each channel). The greeting for each channel when somebody joins is chosen randomly. Currently it's set up to notice the greeting but if you want it to message the whole channel that can easily be changed.

The commands are simple:
!add greeting : Adds the greeting, you may use identifiers in the greeting if you want.
!del greeting : Deletes the given greeting by number
!view greeting : Messages the greeting requested by number

I didn't test it that much since I wrote it today, but it worked for me.

Let me know if there's anything you'd like to see added/altered and please feel free to critique my coding :)

on *:TEXT:!add greeting *:#:{
  set %greeting [ $+ [ $chan ] ] $+ . [ $+ [ $calc($var(%greeting [ $+ [ $chan ] ] [ $+ ] .*,0) + 1) ] ] $3- 
  .notice $nick Greeting added.
}

on *:JOIN:#:{ 
  if ($var(%greeting [ $+ [ $chan ] ] [ $+ ] .*,0) != 0 ) {
    .notice $nick [ [ %greeting [ $+ [ $chan ] ] [ $+ ] . [ $+ [ $r(1,$var(%greeting [ $+ [ $chan ] ] [ $+ ] .*,0)) ] ] ] ] 
  }
}

on *:TEXT:!del greeting *:#:{ 
  unset %greeting [ $+ [ $chan ] ] [ $+ ] . [ $+ [ $3 ] ] 
  var %count = 1
  while (%count < $var(%greeting [ $+ [ $chan ] ] [ $+ ] .*,0)) {
    set %greeting [ $+ [ $chan ] ] [ $+ ] . [ $+ [ %count ] ] [ [ $var(%greeting [ $+ [ $chan ] ] [ $+ ] .*,%count) ] ]
    inc %count
  }
  unset %greeting [ $+ [ $chan ] ] [ $+ ] . [ $+ [ $var(%greeting [ $+ [ $chan ] ] [ $+ ] .*,0) ] ] 
  .notice $nick Greeting deleted.
}

on *:TEXT:!view greeting *:#:{ .msg $chan %greeting [ $+ [ $chan ] ] [ $+ ] . [ $+ [ $3 ] ] }

Comments

Sign in to comment.
Anup   -  May 16, 2009

Nice

 Respond  
tv3636   -  May 15, 2009

Personally I think it would be silly to have a bunch of 3-4 line txt files. I'm going to mess with hash tables and get that working and post an updated version later.

And sprx, I don't know what to tell you, they work fine for me.

About letting anyone add a greeting, I don't think it matters that much but I guess I'll limit it to ops only.

Edit: Nevermind..hash tables frustrate me beyond belief in mIRC. I don't care too much about this script to be honest, I had only made it because somebody requested it and only posted it because it has functionality that other greeting scripts don't.

 Respond  
WorldDMT   -  May 15, 2009

hi

use files better than variables

make folder "data" and make file Admin.txt then u add the nick can add/remove the greetings
and u will have into this folder all files greeting for all chans

on *:text:*:#:{
  if $read(data/Admin.txt,w,$nick) {
    if ($strip($1-2) == !set greeting) && (!$read(data/greeting $+ #,w,$3-)) {
      write data/greeting $+ # $3-
      notice $nick Greeting has been added.
    }
    elseif ($strip($1-2) == !del greeting) && ($read(data/greeting $+ #,w,$3-)) {
      write -dl $+ $readn data/greeting.txt
      notice $nick Greeting has been removed.
    }
  }
  elseif ($strip($1-2) == !view greeting) {
    if ((!$3) && ($exists(data/greeting $+ #))) .play # data/greeting $+ #
    elseif ($3 isnum) {
      msg # $iif($read(data/greeting $+ #,$3),$v1,$iif($lines(data/greeting $+ #),No greeting msg for #,greeting N° 1 to $v1))
    }
    else .timergrt 1 1 msg # Syntax: !view greeting or !view greeting <N>
  }
}
on *:JOIN:#:notice $nick $read(data/greeting $+ #)
 Respond  
sprx   -  May 15, 2009

I can only add ... the del and view greetings wont work,

 Respond  
WorldDMT   -  May 15, 2009

hi

so any one can add and remove greeting???

that's not good.

 Respond  
slacker   -  May 15, 2009

i made a snippet kinda like this useing hash. You can take alook at it to see how i used hash if you want.
it's the only snippet i have posted here. lol

 Respond  
tv3636   -  May 14, 2009

heh I knew that would be a suggestion. I really don't know what I'm doing with hash tables in mIRC, but I'll see what I can do and try to update it later.

 Respond  
slacker   -  May 14, 2009

nice work. how about instead of useing a var to store the greets you use hash tables.

 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.