Top

!Slang Urban Dictionary Script


mIRC Code
+ 2 likes
Please Register to submit score.
Bookmark and Share
Average Score  9.0 (of 2 scores)
Date Added  Mar 23, 2009
Last Updated  Jul 01, 2009
Tags  bad  censored  dictionary  slang  socket  urban  word 

Introduction

I know several other people have made scripts that use Urban Dictionary. I've seen a few of them and I like mine better :)
*******************This Script Requires mIRC 6.32 or Higher***********************
This script will work with older versions of mIRC but some text will get cut of on longer posts.
**********************************************************************************
Now then :) Because Urban Dictionary can be very offensive, I added a badword censor to this script. This might seem funny to some people, but it's not very funny when you come home from work and find you have been glined for racial slurs. If you don't add anything to the badword dictionary, then it doesn't do anything at all. FYI. It's there if you need it or want to use it.
Myself, I added some very offensive terms and racially offensive ones. The censor is very primitive. All it does is replace the words with $#%@! ;/
Anyhow! There is a !slang trigger - Syntax: !slang word|phrase || !slang number word|Phrase.
There is also a private alias - Syntax: /slang word|Phrase || /slang number word|Phrase.
Enjoy :) This is a fun script :)

Grab the Code

;*******************************************************************************************************
;*******************************************************************************************************
;**Urban Dictionary Script by Ford_Lawnmower                                                                                      **
;**This script gets a slang definition from UrbanDictionary.com  and displays it in the active channel.            **
;**This script will Not work right with versions of mirc prior to 6.32                                                        **
;**mIRC 6.32 or higher is required                                                                                                         **
;**Syntax is !Slang number searchword                                                                                                   **
;**For instance !Slang 1 test                                                                                                                **
;**The number can be optionally omitted. !Slang test and !Slang 1 test will produce the same results.              **
;**I also added a censored alias to this because it can be a little offensive at times. See the Channel menu     **
;**to add words. I also added a alias /slang word\words or /slang # word\words                                          **
;**Any questions or comments, You can contact me On Mindforge #USA ,#Hollywood, Abjects #Technical       ** 
;**WyldRyde #Script-Help, SwiftIRC #Technical                                                                                    **
;*******************************************************************************************************
;*******************************************************************************************************
;The text above probably looks Stooooopid on some scripts editors
;mIRC's new scripts editor sucks ;/
alias UD.UDout {
  if (%UD.chan == ECHO) {
    echo -a 4Sorry %UD.nick 9I could Not find the $chr(35) $+ %UD.search.NO definition for $replace(%UD.search,+,$chr(32)) 02:04( %UD.spam
  }
  else {
    .msg %UD.chan 4Sorry %UD.nick 9I could Not find the $chr(35) $+ %UD.search.NO definition for $replace(%UD.search,+,$chr(32)) 02:04( %UD.spam
    UD.clear
  }
}
alias UD.clear {
  unset %UD*
  unset %number.checker
  sockclose UD
  .timer-UD off
  halt
}
#UD.Trigger On
on *:TEXT:!slang*:#: {
  if (%UD.inuse == 1) { .notice $nick Sorry, But Somebody else is already looking up a slang term. %UD.spam | halt }
  ;Change this variable to spam your own site on error :)
  set %UD.spam 7Please visit http://www.hawkee.com/snippets/user/57314/ if you like this script :)
  set %UD.inuse 1
  set %UD.nick $nick
  set %UD.chan $chan
  set %UD.search.NO $2
  set %number.checker $2 * 1
  if ($2 == %number.checker) {
    if (%number.checker <= 7) { set %UD.page 1 | set %UD.search $replacex($3-,$chr(32),+) }
    if (%number.checker > 7 && %number.checker <= 14) { set %UD.page 2 | set %UD.search $replacex($3-,$chr(32),+) }
    if (%number.checker > 14 && %number.checker <= 21) { set %UD.page 3 | set %UD.search $replacex($3-,$chr(32),+) }
    if (%number.checker > 21) { .msg %UD.chan 6.!Slang %number.checker $3- 4Wow! 6I'm not going that high!. 7Try a different word! %UD.spam | UD.clear }
  }
  if ($2 != %number.checker) { set %UD.page 1 | set %UD.search.NO 1 | set %UD.search $replacex($2-,$chr(32),+) }
  sockclose UD
  set %UDurl /define.php?page= $+ %UD.page $+ &term= $+ %UD.search
  set %UDsite www.urbandictionary.com
  set %UD.address http:// $+ %UDsite $+ %UDurl
  sockopen UD %UDsite 80
  .msg $chan 4 $chan 5UrbanDictionary Search... 7Searching for4 Your Slang Term 3Please Wait.....
  .timer-UD 1 15 UD.UDout
}
#UD.Trigger End
alias Slang {
  set %UD.nick $me
  set %UD.chan Echo
  set %UD.search.NO $1
  set %number.checker $1 * 1
  if ($1 == %number.checker) {
    if (%number.checker <= 7) { set %UD.page 1 | set %UD.search $replacex($2-,$chr(32),+) }
    if (%number.checker > 7 && %number.checker <= 14) { set %UD.page 2 | set %UD.search $replacex($2-,$chr(32),+) }
    if (%number.checker > 14 && %number.checker <= 21) { set %UD.page 3 | set %UD.search $replacex($2-,$chr(32),+) }
    if (%number.checker > 21) { Echo -a 6./Slang %number.checker $2- 4Wow! 6I'm not going that high!. 7Try a different word! %UD.spam | UD.clear }
  }
  if ($1 != %number.checker) { set %UD.page 1 | set %UD.search.NO 1 | set %UD.search $replacex($1-,$chr(32),+) }
  sockclose UD
  set %UDurl /define.php?page= $+ %UD.page $+ &term= $+ %UD.search
  set %UDsite www.urbandictionary.com
  set %UD.address http:// $+ %UDsite $+ %UDurl
  sockopen UD %UDsite 80
  .timer-UD 1 15 UD.UDout
}
on *:sockopen:UD: {
  sockwrite -n $sockname GET %UDurl HTTP/1.1
  sockwrite -n $sockname Host: %UDsite $+ $CRLF $+ $CRLF
}
on *:sockread:UD: {
  if ($sockerr > 0) { .notice %UD.nick There has been an error... We could not retrive your slang term. %UD.spam | UD.clear }
  else {
    var %UDvar |  sockread %UDvar
    if ($httpstrip(%UDvar) == %UD.search.NO $+ .) { set %UD.found 1 }
    if (%UD.found == 1) {
      if (%UD.word.found == 1 && %UD.word == $null) { set %UD.word %UDvar }
      if (<td class='word'> isin %UDvar) { set %UD.word.found 1 }
      if (%UD.define.found == 1) && (</div> isin %UDvar) { set %UD.define.found 0 }
      if (%UD.define.found == 1) && ($httpstrip(%UDvar)) { 
        if ($calc( [ $len(%UD.define) ] +  [ $len($httpstrip(%UDvar)) ] ) <= $calc(420 - $len(%UD.search))) { 
          set %UD.define %UD.define $+  $replace($httpstrip(%UDvar),$chr(13),06 $+ $chr(7) $+ 07) 
        }
        if (!%UD.define) && ($len($httpstrip(%UDvar)) > $calc(420 - $len(%UD.search))) {
          set %UD.define $left($httpstrip(%UDvar),$calc(420 - $len(%UD.search))) $+ ...
          set %UD.define.found 0
        }
        else {
          set %UD.define %UD.define $+ ...
          set %UD.define.found 0
        }
      }
      if (<div class='definition'> isin %UDvar) { set %UD.define.found 1 }
      if (%UD.example.found == 1) && (%UDvar == </div>) { set %UD.example.found 0 }
      if (%UD.example.found == 1) && ($httpstrip(%UDvar)) { set %UD.example %UD.example $+ $replace($httpstrip(%UDvar),$chr(13),06 $+ $chr(7) $+ 07) }
      if (<div class='example'> isin %UDvar) { set %UD.example.found 1 | set %UD.define.found 0 }
    }
    if (class="author"> isin %UDvar && %UD.found == 1) {
      if (%UD.chan == ECHO) {
        echo -a  4 **6 %UD.word 7 $censored($httpstrip(%UDvar))
        echo -a 4 **6 %UD.word 7 $censored($remove(%UD.define,&quot;,$chr(10),$chr(13),&gt;,&amp;,&lt;))
        if (%UD.example) { echo -a 4 **6 %UD.word 7 $censored($remove(%UD.example,&quot;,$chr(10),$chr(13),&gt;,&amp;,&lt;)) }
        echo -a 4 **6 %UD.word 7 %UD.address
        sockread %UDvar
        UD.clear
      }
      else {
        .msg %UD.chan 4 **6 %UD.word 7 $censored($httpstrip(%UDvar))
        .msg %UD.chan 4 **6 %UD.word 7 $censored($remove(%UD.define,&quot;,$chr(10),$chr(13),&gt;,&amp;,&lt;))
        if (%UD.example) { .msg %UD.chan 4 **6 %UD.word 7 $censored($remove(%UD.example,&quot;,$chr(10),$chr(13),&gt;,&amp;,&lt;)) }
        .msg %UD.chan 4 **6 %UD.word 7 %UD.address
        sockread %UDvar
        UD.clear
      }
    }
  }
}
alias -l httpstrip {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;)
  return %x
}
alias  censored {
  if (!$hget(censored)) { hmake censored 5 }
  var %censored.string = $1-, %censored.words = $gettok($1-,0,32)
  while %censored.words {
    if ($hfind(censored,$left($gettok(%censored.string,%censored.words,32),4) $+ *,1,w).data) || ($hfind(censored,$gettok(%censored.text,%censored.word,32)).data) {
      %censored.string = $replace(%censored.string,$gettok(%censored.string,%censored.words,32),!@#&)
    }
    dec %censored.words
  }
  return %censored.string
}
alias censored.list {
  var %censored.counter = $hget(censored,0).item
  while %censored.counter {
    echo -a $hget(censored,%censored.counter).item $hget(censored,%censored.counter).data
    dec %censored.counter
  }
}
menu channel {
  .Urban Dictionary
  ..Add Badwords: {
    if (!$hget(censored)) { hmake censored 5 }
    $?="Enter the badword" 
    if ($!) {
      if (!$hfind(censored,$!).data) { 
        hadd  censored $calc($hget(censored,0).item + 1) $!
        echo -a $! added to badword list 
      }
      else { echo -a $! is already in my database. }
    }
  }
  ..Delete Badwords: {
    $?="Enter the bad word or the item number!"
    if ($!) {
      if ($! isnum) && ($hget(censored,$!)) {
        echo -a $hget(censored,$!) was deleted!
        hdel  censored $!
        halt
      } 
      if ($! isalpha) && ($hfind(censored,$!).data) {
        echo -a $! has been deleted from my database!
        hdel censored $hfind(censored,$!).data
      } 
      else { echo -a Can't find $! in my database. Try checking the list. }
    }
  }
  ..List Badwords:censored.list
  ..$iif($group(#UD.Trigger) == On,$style(2)) Trigger On: .enable #UD.Trigger
  ..$iif($group(#UD.Trigger) == Off,$style(2)) Trigger Off: .disable #UD.Trigger 
}
On *:Unload: {
  hfree censored
}
On *:Start: {
  if (!$hget(censored)) { hmake censored 5 }
  if ($isfile(censored.hsh)) { hload -s censored censored.hsh }
}
On *:Exit: {
  if ($hget(censored)) { hsave -s censored censored.hsh }
}
On *:Disconnect: {
  if ($hget(censored)) { hsave -s censored censored.hsh }
}

Comments

  (12)  RSS
Aucun50
Comments: 548
 
mIRC Snippet:  !Slang Urban Dictionary Script
Posted on Mar 24, 2009 2:02 am
Not the same without the "Napa" added :(
FordLawnmower
Comments: 384
 
mIRC Snippet:  !Slang Urban Dictionary Script
Posted on Mar 24, 2009 10:15 am
"Napa" ??
Aucun50
Comments: 548
 
mIRC Snippet:  !Slang Urban Dictionary Script
Posted on Mar 24, 2009 2:58 pm
FordLawnmower
Comments: 384
 
mIRC Snippet:  !Slang Urban Dictionary Script
Posted on Mar 24, 2009 6:58 pm
I see ;/ If I added dialogs to all my Snippets I would need more ram to display them all.
Besides, this is primarily a bot script. I have a browser already ;/ 10 minute job to make dialogs for this anyway. Just Do It!
In edition, "Napa" , I did add more to this script then 99% of all the scripters who have scripted it. I don't think anyone else has taken the time to give you the option to censor the content.
Thanks for the lil' Comment Aucun50 :)
Kirby
Comments: 473
 
mIRC Snippet:  !Slang Urban Dictionary Script
Posted on Mar 24, 2009 7:31 pm
Lol Aucun. XD
FordLawnmower: Interesting to see another Urban Dictionary snippet. :) :)

I am surprised, though, that you implemented the "page" method that I used for my UD snippet, so that you can define any word on any page; most Urban Dictionary scripts only define up to 7, so good job on that part. Having prior knowledge that there are 7 terms on each page really helps. :D

Though, I like mine better. Sorry. :P
FordLawnmower
Comments: 384
 
mIRC Snippet:  !Slang Urban Dictionary Script
Posted on Mar 24, 2009 11:14 pm
Yea, I first made this script about a year ago. One of the first things I noticed messing with the site, was that there were consistently 7 items on each page. I never looked at your script, but I cut mine off at 21.
I really just posted this because of the edition of the badword censor. I knew there were lots of UD scripts out there.
At the time I made this, the most popular UD script was the one that used a parser site of some sort. I got tired of the constant spam and the happy Halloween, merry Christmas stuff. So I made this one.
If I had known of another, working UD script then, I would have just loaded it.
uneek
Comments: 26
 
mIRC Snippet:  !Slang Urban Dictionary Script
Posted on Mar 25, 2009 10:45 pm
Saw this over at swiftirc a while ago too :D Been using it ever since.
sk68
Comments: 61
 
mIRC Snippet:  !Slang Urban Dictionary Script
Posted on Jul 1, 2009 7:43 pm
it never finds anything for me, even with words that I know are there =\

Quote:
( 20:38:18 ) ( [Pyro] ) !ud don't eat the cheese
( 20:38:18 ) ( @sk68Bot ) #kito UrbanDictionary Search... Searching for Your Slang Term Please Wait.....
( 20:38:33 ) ( @sk68Bot ) Sorry [Pyro] I could Not find the #1 definition for don't eat the cheese :( Please visit http://www.hawkee.com/snippets/user/57314/ if you like this script :)


NOTE: yes, I did change the trig
FordLawnmower
Comments: 384
 
mIRC Snippet:  !Slang Urban Dictionary Script
Posted on Jul 1, 2009 8:03 pm
I see sk68. Thanks for pointing this out. Something must have changed with the UD site. I'll check into it and post a update as soon as I can.
FordLawnmower
Comments: 384
 
mIRC Snippet:  !Slang Urban Dictionary Script
Posted on Jul 1, 2009 8:45 pm
It's working now sk68. Just use the updated code. Thanks for the tip :)
PATX
Comments: 390
 
mIRC Snippet:  !Slang Urban Dictionary Script
Posted on Jul 1, 2009 11:09 pm
8/20. good job. AGAIN!!!
sk68
Comments: 61
 
mIRC Snippet:  !Slang Urban Dictionary Script
Posted on Jul 2, 2009 8:44 am
awesome, works great now, thanks

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom