Bot dictionary

By simplicity on Sep 15, 2007

A dictionary I made for my bot. It's pretty simple to use:

!addef (word) (definition)
!deldef (word)
!editdef (word) (definition)
!viewdictionary
!define (word)

Please type: /set %myowner (owner) in the bot's mirc so that it will respond to you.

; Dictionary
; by simplicity

on *:LOAD:{ 
 echo $color(info) -a Setup for bot owner..
 set %myowner $?="enter the nick you wish to set as the owner for this script"
}

on *:TEXT:*:#:{ 
  if ($nick iswm %myowner) { 
    ;dictionary 
    if ($1 iswm !addef) && ($2-3) { 
      while (!$readini(bot.ini,words,$2)) { 
        writeini -n bot.ini words $2 $3-
        notice $nick Word $2 has been added!
        halt
      }
      if ($readini(bot.ini,words,$2)) { notice $nick Definition $+(',$2,') is in the dictionary! | halt }
    }
    if ($1 iswm !deldef) && ($2) { 
      while ($readini(bot.ini,words,$2)) { 
        remini bot.ini words $2 
        notice $nick Word $2 has been deleted.
        halt
      }
      if (!$readini(bot.ini,words,$2)) { notice $nick Definition $+(',$2,') in the dictionary! | halt }
    }
    if ($1 iswm !editdef) && ($2-3) { 
      while ($readini(bot.ini,words,$2)) { 
        writeini -n bot.ini words $2 $3-
        notice $nick Word $2 has been edited.
        halt
      }
      if (!$readini(bot.ini,words,$2)) { notice $nick Definition $+(',$2,') isn't in the dictionary! | halt }
    } 
    if ($1 iswm !viewdictionary) { run bot.ini } 
    if ($1 iswm !define) && ($2) { 
      while ($readini(bot.ini,words,$2)) { 
        msg $chan Definition for word $+($2,:) $readini(bot.ini,words,$2)
        halt
      }
      if (!$readini(bot.ini,words,$2)) { notice $nick Definition $+(',$2,') isn't in the dictionary! | halt }
    } 
  }
}

Comments

Sign in to comment.
BigSteve   -  Jan 27, 2011

why dont you use the user variable

 if ($address == youruserhost) 
 Respond  
Jethro   -  Jan 27, 2011

Zsadist, I don't believe that will work. You should make it like so

%owner *!*@host
if ($wildsite == %owner) 

I don't see the point of a variable if you're gonna match for one host.

 Respond  
Zsadist   -  Jan 27, 2011

Personally, I would do a more secure method:

%owner $address($nick,2)

if ($address($nick,2) == %owner)

 Respond  
Ghost-writer   -  Aug 13, 2009

wtf just do variables if ( $nick == %owner ) { no need for the iswm :X and good script!

 Respond  
guest598594   -  Jan 01, 2008

oh wait, i think im wrong

(im on my wii so i cant do the alias)

but i think the nick would have to be bell , which i dont thin, u can do :P

 Respond  
Rebellious   -  Jan 01, 2008

Well, try it out. /testnick bell and see what you get. ;)

 Respond  
guest598594   -  Jan 01, 2008

but im saying, \"bell\" iswm rebellious

so if ur nick was bell, you\'d have power ;)

 Respond  
Rebellious   -  Jan 01, 2008

why \"if ($nick [b]iswm] %myowner) {\" ?

someone could simply use a similar nick to the owner and delete every word ... and for the other if\'s, u should use ==

No, not really. It would have to use $+(,%myowner,) or something similar to match the nick. Just %myowner would make the script make sure it was positively %myowner.

Try it using something like this:

alias testnick { 
  if ($1 iswm Rebellious) { echo -a Match! }
  else { echo -a No match! }
}

/testnick Rebellious would return Match! while /testnick Rebellious1 would return No match!

But yes, this snippet has a LOT of room for improvement.

 Respond  
guest598594   -  Jan 01, 2008

why \"if ($nick [b]iswm] %myowner) {\" ?

someone could simply use a similar nick to the owner and delete every word ... and for the other if\'s, u should use ==

for the if $2-3, u only need if $3 because if there is a $3, there\'s automatically a $2

and rather than using while, use if and else

and rather than halting, put a . in front of the command (.notice $nick ...)

 Respond  
juuruichki   -  Jan 01, 2008

and another thing (idk if you noticed it) if you type * it adds the first word in your text to the dictionary then the following text as the definition

 Respond  
juuruichki   -  Jan 01, 2008

is there any way i can add more than one owner jic other people want to use it also?

 Respond  
simplicity   -  Sep 22, 2007

Done.

 Respond  
Cazz   -  Sep 22, 2007

hmmm...
very nice but maybe you could add
an \"on *:LOAD:\" and have it ask for the owner name.

 Respond  
ermansanidhya   -  Sep 20, 2007

look interisting i will try it

 Respond  
ZiX   -  Sep 17, 2007

hmm 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.