Channel Greet System For A Bot

By blackvenomm666 on Jun 18, 2011

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

Comments

Sign in to comment.
blackvenomm666   -  Jun 18, 2011

ooo i'll take a look into it:) ty

 Respond  
Jethro   -  Jun 18, 2011
/hmake test 5
/hload -i test file.ini <INI Section Name Here>

mIRC will then load your INI file's item and value within that section to the hash table you make called test.

 Respond  
Jethro   -  Jun 18, 2011

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.

 Respond  
blackvenomm666   -  Jun 18, 2011

nicely done jeth. i still need to learn hash tables though haha:).

 Respond  
Jethro   -  Jun 18, 2011

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
}
 Respond  
Jordyk19   -  Jun 18, 2011

Meh, 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.