Simple Channel greet system for a bot. Add to a new remotes file then just do !setgreet greethere and everytime you enter the channel you set it on it will greet you with your preset greet. You can reset your greet as well with the !resetgreet command. And check it with !checkgreet.
on !*:join:#: {
if ($readini(greet.ini,$chan,$nick)) {
.msg $chan $readini(greet.ini,$chan,$nick)
}
}
on $*:TEXT:/^(!setgreet)/Si:#:{
if ($readini(greet.ini, $chan,$nick)) {
.notice $nick your greet is already set as $readini(greet.ini,$chan ,$nick,4) to change it do !resetgreet first
}
else { writeini greet.ini $chan $nick $2-
}
}
on $*:TEXT:/^(!resetgreet)/Si:#:{
remini greet.ini $chan $nick
}
on $*:TEXT:/^(!checkgreet)/Si:#:{
if (!$readini(greet.ini, $chan,$nick)) {
msg $chan $nick you do not have a greet set up for this channel type !setgreet yourgreet to set a greet
}
else { if ($readini(greet.ini,$chan,$nick)) {
msg $chan $nick your greet is set as $readini(greet.ini,$chan,$nick)
}
}
}
INI works very similar to hash table, except for the fact that a hash table needs to be saved to retain the info stored upon closing or exiting. If you already know how INI works, it should be a piece of cake for you when it comes to hash table. Incidentally, hash table has an internal command hload and the -i switch you can import INI file item and data to hash table with ease.
My hash table version if interested:
on *:exit: hsave -o greet greet
on *:start: if ($file(greet).shortfn) hmake greet 100 | hload greet $v1
on *:join:#: if ($hfind(greet,$nick,1,w)) .msg # $hget(greet,$v1)
on $*:text:/^!((re)?(set)|check)greet/iS:#:{
var %c $hfind(greet,$nick,1,w), %1 notice $nick Your greet's already $&
set as $qt($hget(greet,%c)) To change it, use !resetgreet first.
var %2 .notice $nick Your greet has been set to $!hget(greet,$nick) successfully!
var %3 .notice $nick Your greet message is now deleted!
var %4 .notice $nick I can't find your greet message. It's removed or hasn't been added.
var %5 .notice $nick You have yet to be set up for greet. Enter !setgreet $&
<Your Message Here> to get started. Without setting a message, you'll only be greeted with "Hello."
var %6 .notice $nick Your greet message is: $hget(greet,$nick)
goto $regml(1) | :set | if !%c { hadd -m greet $nick $iif(!$2,Hello,$2-) | [ [ %2 ] ] } | else %1 | halt
:reset | if %c { hdel greet $nick | %3 } | else %4 | halt | :check | if !%c { %5 } | else %6 | halt
}