Definition script

By wto_xray on Jul 04, 2009

Just put this in your remotes and then type !learn (topic) (definition)
type !del (word) to delete the definition and type !r (topic) for the bot to say the definition
I also made it so only certain people can add and delete the definitions. Just replace $nick1 $nick2 $nick3 with the 3 people you want. You can add more people though
Hope you like :-)

on *:TEXT:!learn *:#: { if ($istok($nick1 $nick2 $nick3,$nick,32)) {
    if (!$3) {
      notice $nick You didn't specify the right parameters.
      notice $nick Syntax: !learn <topic>: <description>
    }
    else {
      hadd -m learn $strip($2) $3-
    msg $chan  $strip($2) : $3- }
  }
}
on *:TEXT:!r *:#: {
  if (!$2) {
    notice $nick You didn't specify the right parameters.
    notice $nick Syntax: !r <topic>
  }
  elseif (!$hget(learn,$strip($2))) {
    msg $chan No data was found for $2 $+ .
  }
  else {
    msg $chan  $strip($2) : $+  $hget(learn,$2)
  }
}
on *:TEXT:!del *:#: { if ($istok($nick1 $nick2 $nick3,$nick,32)) {
    if (!$2) {
      notice $nick You didn't specify the right parameters.
      notice $nick Syntax: !del <topic>
    }
    elseif (!$hget(learn,$strip($2))) {
      msg $chan No data was found for $strip($2) $+ .
    }
    else {
      notice $nick Removed Definition $strip($2) ( $+ $hget(learn,$strip($2)) $+ ) 
    hdel learn $strip($2) }
  }
}
alias viewlearn {
  window -a @Learn
  var %x = 1
  while (%x <= $hget(learn,0).item) {
    echo -g @Learn $hget(learn,%x).item $+ : $hget(learn,%x).data
    inc %x
  }
}
on *:EXIT: { hsave learn learn.txt }
on *:START: { 
  if (!$isfile(learn.txt)) {
    noop $input(The hash table for the learn bot could not be found.,uwo,Error!)
  }
  else {
    hmake learn 100
    hload learn learn.txt 
  }
}

Comments

Sign in to comment.
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.