Top

!Slang Urban Dictionary Script


mIRC Code
+ 2 likes
Please Register to submit score.
Bookmark and Share
Average Score  9.3 (of 3 scores)
Date Added  Mar 23, 2009
Last Updated  Nov 08, 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 :)

***Updated***
Script was broken so I rewrote the socket portion from scratch.
Triggers are now !slang, @slang and /slang(alias)
!slang will notice the user.
@slang will message the channel if the user has ops.
/slang is a local alias to be typed from the bot.

Syntax is !slang # words here
Where ! could be @ or / and # is a number.
The number is optional.
Example: !slang 1 funny money
Example: @slang funny money

I also added a random word and attached it with !slang. If you type !slang without a number or search word it will return a random result.
18:20:03 <Ford_Lawnmower> @slang
18:20:04 <BOX> Word - hashist
18:20:06 <BOX> Definition - One who believes in the principles and leads a life dedicated to the use of marijuana and spreading its virtues as the new gospel.
18:20:06 <BOX> Example Dude you are either always stoned or talking about getting stoned you are becoming a real hashist!
18:20:07 <BOX> Author - by samlap - http://www.urbandictionary.com/define.php?page=1&term=hashist


Grab the Code

;Urban Dictionary Script by Ford_Lawnmower irc.mindforge.org #USA-Chat
menu Channel,Status {
  .$iif($group(#UD) == On,$style(1)) Urban Dictionary
  ..$iif($group(#UD) == On,$style(2)) Trigger On: .enable #UD
  ..$iif($group(#UD) == Off,$style(2)) Trigger Off: .disable #UD
  ..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
}
#UD off
On $*:Text:/^(!|@)Slang.*/Si:#: {
  if (!$timer($+(UD,$network,$nick))) {
    .timer $+ $+(UD,$network,$nick) 1 6 noop
    var %method $iif($regml(1) == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%)/),.msg $chan,.notice $nick))
    UD %method $2-
  }
}
#UD end
alias slang { UD echo -a $1- }
alias -l UD {
  var %sockname $+(UD,$network,$2,$ticks)
  var %UD.url $iif($3,$replace($+(/define.php?page=,$iif($ceil($calc($3 / 7)),$v1,1),&term=,$iif($3 !isnum,$3-,$4-)),$chr(32),+),/random.php)
  sockopen %sockname www.urbandictionary.com 80
  sockmark %sockname $1-2 %UD.url $iif($3 isnum,$iif($calc($3 % 7),$v1,7),1) 0 0
}
On *:sockopen:UD*: {
  if (!$sockerr) {
    sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.1
    sockwrite -n $sockname Host: www.urbandictionary.com
    sockwrite -n $sockname $crlf
  }
  else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
}
On *:sockread:UD*: {
  if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
  else {
    var %UD | sockread %UD
    if (Location: http://www.urbandictionary.com/define.php?term isin %UD) {
      UD $gettok($sock($sockname).mark,1-2,32) 1 $gettok(%UD,-1,61)
      sockclose $sockname
      return
    }
    if (<div id='not_defined_yet'> isin %UD) { $gettok($sock($sockname).mark,1-2,32) Sorry that word has yet to be defined. }
    if (<td class='index'> isin %UD) { sockmark $sockname $puttok($sock($sockname).mark,$calc($gettok($sock($sockname).mark,5,32) + 1),5,32)  }
    if ($gettok($sock($sockname).mark,5,32) == $gettok($sock($sockname).mark,4,32)) {
      if ($gettok($sock($sockname).mark,6,32) == word && $httpstrip(%UD)) { 
        if (<span style='font-weight: normal'> !isin %UD) { $gettok($sock($sockname).mark,1-2,32) 06Word -04 $censored($httpstrip(%UD)) }
        sockmark $sockname $puttok($sock($sockname).mark,0,6,32)
      }
      if ($regex(%UD,/<div class='(.*)'>/)) { sockmark $sockname $puttok($sock($sockname).mark,$regml(1),6,32) }      
      if ($gettok($sock($sockname).mark,6,32) == definition && $httpstrip(%UD)) { put $gettok($sock($sockname).mark,1-2,32) 06Definition -04 $censored($replace($v1,$chr(13),$chr(32))) }
      if ($gettok($sock($sockname).mark,6,32) == example && $httpstrip(%UD)) { put $gettok($sock($sockname).mark,1-2,32) 06Example -04 $censored($replace($v1,$chr(13),$chr(32))) } 
      if (<a href="/author.php?author= isin %UD) { 
        put $gettok($sock($sockname).mark,1-2,32) 06Author -04 $censored($httpstrip(%UD) - $+(07,http://www.urbandictionary.com,$gettok($sock($sockname).mark,3,32)))
        sockclose $sockname
        return
      }
      if (%UD == <td class='word'>) { sockmark $sockname $puttok($sock($sockname).mark,word,6,32) }
    }
  }
}
alias -l httpstrip { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x) | return $remove($replace(%x,&amp;,&,&quot;,"),&nbsp;,&lt;) }
alias -l Put {
  if (!$regex($1,/(\.|^)(msg|notice|echo)$/Si)) || (!$3) { echo -st **Put error** Syntax /Put msg #channel text - or - /Put notice nickname text  | return }
  var %tokens $0, %Tstart 3, %Dtimer 1500
  if ($timer($+(Put,$2,$network)).secs) { %Dtimer = $calc($v1 * 1000) }  
  while ($len($($+($,%Tstart,-,%tokens),2)) > 430) {
    dec %tokens
    if ($len($($+($,%Tstart,-,%tokens),2)) <= 430) {
      .timer -m 1 %Dtimer $1-2 $+(04,$($+($,%Tstart,-,%tokens),2)))
      inc %Dtimer 1500
      %Tstart = $calc(%tokens + 1)
      %tokens = $0
    }
  }
  .timer -m 1 %Dtimer $1-2 $+(04,$($+($,%Tstart,-,%tokens),2)))
  .timer $+ $+(Put,$2,$network) -m 1 $calc(%Dtimer + 1500) noop 
}
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
  }
}
On *:Unload: { hfree censored }
On *:Start: {
  if (!$hget(censored)) { hmake censored 5 }
  if ($isfile(censored.hsh)) { hload censored censored.hsh }
}
On *:Exit: { if ($hget(censored)) { hsave censored censored.hsh } }
On *:Disconnect: { if ($hget(censored)) { hsave censored censored.hsh } }

Comments

  (17)  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: 411
 
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: 411
 
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: 475
 
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: 411
 
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: 411
 
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: 411
 
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
rockqc
Comments: 4
 
mIRC Snippet:  !Slang Urban Dictionary Script
Posted on Nov 8, 2009 6:30 am
Great script.

Doesn't seem to be working anymore though. Something must of changed again on the UD site.
FordLawnmower
Comments: 411
 
mIRC Snippet:  !Slang Urban Dictionary Script
Posted on Nov 8, 2009 6:38 pm
Hey thanks for the heads up rockqc. I'll get it fixed pronto.
FordLawnmower
Comments: 411
 
mIRC Snippet:  !Slang Urban Dictionary Script
Posted on Nov 8, 2009 6:43 pm
***Updated***
Script was broken so I rewrote the socket portion from scratch.
Triggers are now !slang, @slang and /slang(alias)
!slang will notice the user.
@slang will message the channel if the user has ops.
/slang is a local alias to be typed from the bot.

Syntax is !slang # words here
Where ! could be @ or / and # is a number.
The number is optional.
Example: !slang 1 funny money
Example: @slang funny money

I also added a random word and attached it with !slang. If you type !slang without a number or search word it will return a random result.
18:20:03 <Ford_Lawnmower> @slang
18:20:04 <BOX> Word - hashist
18:20:06 <BOX> Definition - One who believes in the principles and leads a life dedicated to the use of marijuana and spreading its virtues as the new gospel.
18:20:06 <BOX> Example Dude you are either always stoned or talking about getting stoned you are becoming a real hashist!
18:20:07 <BOX> Author - by samlap - http://www.urbandictionary.com/define.php?page=1&term=hashist
rockqc
Comments: 4
 
mIRC Snippet:  !Slang Urban Dictionary Script
Posted on Nov 9, 2009 8:24 am
Nice one. Thanks for the quick response, much appreciated mate.
FordLawnmower
Comments: 411
 
mIRC Snippet:  !Slang Urban Dictionary Script
Posted on Nov 9, 2009 1:38 pm
No problem rockqc. Thanks for bringing it to my attention :)

Commenting Options

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

  
Bottom