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 ] ] }
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.
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 $+ #)