!Slang Urban Dictionary Script

Platform:  mIRC
Published  Mar 23, 2009
Updated  Jan 29, 2014
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 Usage***

  • Paste this code into a new remote and save it with a unique file name.
  • Type +Slang in each channel you want this script to run in.
  • -Slang to turn it off.

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 ;Urban Dictionary Script by Ford_Lawnmower irc.GeekShed.net #Script-Help
menu Channel,Status {
.$iif($group(#Slang) == On,$style(1)) Slang Trigger
..$iif($group(#Slang) == On,$style(2)) On: .enable #Slang
..$iif($group(#Slang) == Off,$style(2)) Off: .disable #Slang
..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 $!
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
#Slang on
On $*:Text:/^(\+|-|!|@)(Slang|ud).*/Si:#: {
var %action $regml(1)
if (%action isin +-) && ($regex($nick($chan,$nick).pnick,/(!|~|&|@)/)) {
if (%action == +) {
if ($istok(%SlangChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is already running the Slang script }
else {
.enable #Slang
Set %SlangChanList $addtok(%SlangChanList,$+($network,$chan),32)
.msg $chan $nick has activated the Slang script for $chan .
else {
if (!$istok(%SlangChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is not running the Slang script }
else {
Set %SlangChanList $remtok(%SlangChanList,$+($network,$chan),1,32)
.msg $chan $nick has deactivated the Slang script for $chan .
elseif (!$timer($+(Slang,$network,$nick))) && ($istok(%SlangChanList,$+($network,$chan),32)) {
.timer $+ $+(Slang,$network,$nick) 1 6 noop
var %method $iif(%action == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%|\+)/),.msg $chan,.notice $nick))
GetSlang %method $2-
#Slang end
alias slang { GetSlang echo -a $1- }
alias -l GetSlang {
var %sockname $+(SlangUD,$network,$2,$ticks)
var %SlangUD.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 %SlangUD.url $iif($3 isnum,$iif($calc($3 % 7),$v1,7),1) 0 0
svar %sockname method $1-2
svar %sockname url %SlangUD.url
svar %sockname num $iif($3 isnum, $3, 1)
On *:sockopen:SlangUD*: {
if (!$sockerr) {
sockwrite -nt $sockname GET $svar($sockname,url) 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:SlangUD*: {
if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
else {
var %SlangUD | sockread %SlangUD
if (Location: http://www.urbandictionary.com/define.php?term isin %SlangUD) {
GetSlang $svar($sockname,method) 1 $gettok(%SlangUD,-1,61)
sockclose $sockname
elseif (<div id='not_defined_yet'> isin %SlangUD) { $svar($sockname,method) Sorry that word has yet to be defined. }
elseif ($regex(%SlangUD,/<div\sclass=['"]small['"]>/)) {
svar $sockname div small
elseif (($svar($sockname,div) == small) && ($regex(%SlangUD,/(^\d+)\./))) {
svar $sockname itemnum $regml(1)
svar $sockname div noop
elseif ($regex(%SlangUD,/<title>Urban\sDictionary:\s(.*?)<\/title>/i)) {
$svar($sockname,method) 06Word -04 $censored($httpstrip($regml(1)))
elseif ($svar($sockname,num) == $svar($sockname,itemnum)) {
if ($regex(%SlangUD,/<div\sclass=['"]([^>]*)['"]>/i)) {
svar $sockname div $regml(1)
if ($svar($sockname,div) == meaning) {
var %definition $svar($sockname,definition)
svar $sockname definition $+($iif($+($svar($sockname,definition),$chr(32)),$v1),%SlangUD)
if (</div> isin %SlangUD) {
put $svar($sockname,method) 06Definition -04 $censored($replace($httpstrip($svar($sockname,definition)),$chr(13),$chr(32)))
svar $sockname div noop
if ($svar($sockname,div) == example) {
svar $sockname example $+($svar($sockname,example),$chr(32),%SlangUD)
if (</div> isin %SlangUD) {
put $svar($sockname,method) 06Example -04 $censored($replace($httpstrip($svar($sockname,example)),$chr(13),$chr(32)))
svar $sockname div noop
if ($svar($sockname,div) == contributor) {
svar $sockname contributor $+($svar($sockname,contributor),$chr(32),%SlangUD)
if (</div> isin %SlangUD) {
put $svar($sockname,method) 06Author -04 $censored($replace($httpstrip($svar($sockname,contributor)),$chr(13),$chr(32))) - $+(07,http://www.urbandictionary.com,$svar($sockname,url)))
sockclose $sockname
alias -l httpstrip { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x) | return $remove($replace(%x,&amp;,&,&quot;,",&gt;,>,&lt;,<),&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 }
tokenize 32 $fix&#($regsubex($1-,/([$\|%\[\]\}\{][^\s]*)/g,$+($chr(2),$chr(2),\t)))
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
alias -l fix&# {
return $regsubex($regsubex($replace($regsubex($1-,/\&\#([0-9]{1,});/g,$utf8(\t)),&quot;,",&amp;,&,&gt;,>,&lt;,<,&#39;,',$chr(9),$chr(32)),$&
alias -l UTF8 {
if ($version >= 7) return $chr($1)
elseif ($1 < 255) { return $chr($1) }
elseif ($1 >= 256) && ($1 < 2048) { return $+($chr($calc(192 + $div($1,64))),$chr($calc(128 + $mod($1,64)))) }
elseif ($1 >= 2048) && ($1 < 65536) { return $+($chr($calc(224 + $div($1,4096))),$chr($calc(128 + $mod($div($1,64),64))),$chr($calc(128 + $mod($1,64)))) }
elseif ($1 >= 65536) && ($1 < 2097152) {
return $+($chr($calc(240 + $div($1,262144))),$chr($calc(128 + $mod($div($1,4096),64))),$chr($calc(128 + $mod($div($1,64),64))),$&
$chr($calc(128 + $mod($1,64))))
alias -l div { return $int($calc($1 / $2)) }
alias -l mod {
var %int $int($calc($1 / $2))
return $calc($1 - (%int * $2))
alias -l H2U { return $utf8($base($1,16,10)) }
alias -l Svar {
var %sockname $1, %item $+($2,$1)
if ($isid) {
if ($regex(svar,$sock(%sockname).mark,/ $+ %item $+ \x01([^\x01]*)/i)) return $regml(svar,1)
elseif ($3) {
var %value $3-
if (!$regex(svar,$sock(%sockname).mark,/ $+ %item $+ \x01/i)) { sockmark %sockname $+($sock(%sockname).mark,$chr(1),%item,$chr(1),%value) }
else { sockmark %sockname $regsubex(svar,$sock(%sockname).mark,/( $+ %item $+ \x01[^\x01]*)/i,$+(%item,$chr(1),%value)) }
On *:Unload: { hfree censored }
On *:Start: {
unset %UDChanList
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 } }


Sign in to comment.
EpicIcon   -  Jan 11, 2014
Doesn't work for me at all ford @slang @ud !ud !slang does a whois and no response
FordLawnmower  -  Jan 13, 2014
I'll try to get this fixed in the next couple days.
FordLawnmower  -  Jan 24, 2014
Updated and working again.
incognitus  -  Jan 24, 2014
Thanks again, FordLawnmower. Really appreciated!!
incognitus  -  Jan 27, 2014
Stopped working again .. it shows example and author but the definition doesnt come up.
rebel9  -  Jan 27, 2014
Just change line 103:

if ($svar($sockname,div) == definition) {

Remove definition, add 'meaning' like this:

if ($svar($sockname,div) == meaning) {

Next time, open up www.urbandictionary.com, view the source and the info is right there if you spend 20 seconds to look at it.
incognitus  -  Jan 27, 2014
Hey Rebel9,

If i knew where to check in the source i wouldnt be here asking for help, but hey thanks for your help, worked just fine ;)
rebel9  -  Jan 28, 2014
Just offering help.
FordLawnmower  -  Jan 29, 2014
@rebel9 There is really no reason to be rude or arrogant here. It's good to see people step up and help out, but this can be done without talking down to people.
rebel9  -  Jan 30, 2014
FordLawnmower: I didn't mean any disrespect. I don't see why people are so touchy over the internet when I was only trying to help incognitus on how to fix it and read the code and recognize the problem without having to ask questions. I meant absolutely no harm and I was NOT trying to be rude or arrogant by any means. In my opinion, I helped a lot of people figure out how to fix this issue on their own, not just the person who asked the question. That's all I'm doing, no harm no foul, I thought.
Sign in to comment

startmeup   -  Jul 04, 2013
[15:12] <sec0nd> !ud crappola
[15:12] <start`> Definition - A whole load of crap. Not to be confused with shoot.
[15:12] <start`> Example - What&#x27;s all this crappola?

Any idea why I am getting the censored stuff all of a sudden? I changed nothing, I have no censored words. I checked the hsh file and was empty.

I even went back to earlier scripts to see if there was something that I inadvertently did and still the same. Any ideas?
FordLawnmower  -  Jul 04, 2013
@startmeup *Updated*
incognitus  -  Oct 07, 2013
Hey FordLawnmower,

It stopped working few days ago, i think. Can you take a look at that? Many thanks in advance!
FordLawnmower  -  Oct 07, 2013

Thanks for the info. * Updated *
incognitus  -  Oct 07, 2013
You're welcome bud, but its not working, at least for me. No definition whatsoever.
FordLawnmower  -  Oct 09, 2013
@incognitus Can you try testing it from the bot with /slang . This will help narrow the problem.
incognitus  -  Oct 09, 2013
Hey FordLawnmower,

I just tested and nothing shows up. I can activate and deactivate the script but that's it. No definition or any kind of message.
incognitus  -  Oct 13, 2013
Hey FordLawnmower,

I thought it could be OS related, so i tested on other machines and same result. Any ideas? Thanks!
 -  Oct 27, 2013
yea not working here either. no errors or output :/
RicJames  -  Nov 11, 2013
Not working here either. Any chance of an update @FordLawnmower ?
 -  Dec 01, 2013
change line 86
if (<td class='index'> isin %SlangUD) { sockmark $sockname $puttok($sock($sockname).mark,$calc($gettok($sock($sockname).mark,5,32) + 1),5,32) }
if (<a class="index" isin %SlangUD) { sockmark $sockname $puttok($sock($sockname).mark,$calc($gettok($sock($sockname).mark,5,32) + 1),5,32) }
FordLawnmower  -  Dec 01, 2013
I must have forgotten to update this page when I updated the others ;/
It's updated now.
incognitus  -  Dec 01, 2013
Thanks a lot FordLawnmower. Works like a charm as usual. Good job : )
incognitus  -  Jan 11, 2014
Hey FordLawnmower, script seems to be down again. Can you take a look at that please? Thanks ;)
Sign in to comment

ryan7461035   -  Jun 15, 2012
The on/off functions like +slang -slang . Can someone show me how to put it to like !define on / !define off i Use it as Define and Also How to change this [Urban Dictionary] . i Would like it to Say [Define Search]
incognitus   -  Jun 13, 2012
Thanks FordLawnmower, it works great! Any chance to add Ops only? Thanks in advanced!
startmeup   -  Jan 21, 2012

Any chance of an on *:input:#: { for this script?..thanks in advance!
Oct 10, 2011

I hate to bug ya..but...if you could :-)
MashhitDK   -  Oct 22, 2011
You can add it manually under Varibles.
But else search for

and replace it with

Change NewbieGuy to what ever IRC nick you are using
NewbieGuy   -  Oct 22, 2011
Haha I do not mind, its fun for this dead channel I go on, ops seem cool if they said to stop it, I can always unload it. <3
startmeup   -  Oct 21, 2011
You will be kicked for flooding almost suredly and running it without the channel's permission may have its own consequences!
NewbieGuy   -  Oct 21, 2011
Well yeah that is fine for my own channel since I am the owner. But if I were to take into another channel where the ops are dead, can you make it free use ? Like my bot joins a channel which I have no ops to use +slang but it can still run the script with no problem?
FordLawnmower   -  Oct 20, 2011
Your welcome snackled :)
From the Description:

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.

@slang will message the channel if you have Ops.
If you would like the script to work different for you, please explain and I will pastebin an edit for you.
NewbieGuy   -  Oct 20, 2011
This script works for me, my only problem is, it only gives a personal answer and the channel can't see the definition, help please.
snackled   -  Oct 19, 2011
Thank you so much...and wow, talk about a fast response :)
FordLawnmower   -  Oct 19, 2011
@startmeup I'll try to post an update for you this weekend. It's a very small edit , I'm just real busy atm.
@snackled Thanks.
To change the default color for the second line, change line numbers: 115 and 121


These two lines add a default color to text if the line is too large to post in a single message.

This is old code and not very customizable. I'll add it to my rewrite list.
snackled   -  Oct 19, 2011
@FordLawnmower Great script! Thanks for all your work. One question for you...edited everything to remove color and works like a charm, but if the definition is large and spans 2 or more messages, the 2nd and on is always in red. The example, author & link are always ok tho. Any idea?
startmeup   -  Oct 10, 2011
Any chance of an on *:input:#: { for this script?..thanks in advance!
Donovan   -  May 07, 2011
FordLawnmower   -  Jan 09, 2011
@KilllerX First you have to type +slang in each channel you want to run this in.(Requires ops)
The rest I can make an edit and post it here in a few.
Try this edit -->> http://pastebin.com/qJkHE6Cs
KilllerX   -  Jan 09, 2011
Yah. I am having a little problem with this.

I can only activate it with.

/slang (word) [which only echo's it, and I want it messaged]

and unless they are using an irc like mIRC they will see the []12,2. So also if you could help me by not having it colorized. I would appreciated it.

Also if there is a way to take out the example and the user that uploaded it.
FordLawnmower   -  Nov 11, 2010
Thanks Slyvar :)
@startmeup no problem. I'm glad you got it working the way you want :)
startmeup   -  Nov 11, 2010
Just wanted to thank you for your help..script is great and working fine. nice work!
Slyvar   -  Nov 07, 2010
Thnaks Man you're Great

Rated :)
FordLawnmower   -  Nov 07, 2010
Just find this line:

I have it at line 56
Change it to:

Your welcome MashhitDK :)
MashhitDK   -  Nov 07, 2010
Just wanted to say thanks...
- just finished editing the "look" of the pastebin script of yours to suit My bot and look like the rest of My sh*t ;P

So far no errors found... works like a charm :D:D:D:D
Didn't have any problems with adding channels either with the +Slang
ooO( Running mIRC version 6.35 )
startmeup   -  Nov 07, 2010
6.16 works for me now...it was not adding channels, figured how to add in variables manually. my question is...is there an edit so that anyone can trigger it with @slang and have it output to the channel? In a previous comment from henbone11, that it was not outputting to the channel. Well I have found that you must be voiced or opped in order to output to the channel. I would like to have it so that anyone can output to the channel...thanks for your help
FordLawnmower   -  Nov 02, 2010
Okay, I took a look at this issue and found that 1). There is no notice on the flash. 2). The channel identifier %# was being evaluated to $null by the script causing the error.
I have a working edit that I have tested on buzzen with 6.16 & 7.1.
This still requires one of the following to be in pnick to activate the script for a channel. '!&@~ There are no requirements to use the script. !slang @slang will both message the channel. All colors have been removed. Same 6 second flood control.
Let me know if there are anymore problems Jethro_ -->> http://pastebin.com/Gv9BMASy

I will stay on Buzzen for a couple of hours -- %#ScriptORama -- Contact me there if you find an issue right away.
Jethro   -  Nov 02, 2010
The problem is still unresolved and the same as shown in my quote above. I'm opped and so is my bot. I can't for the life of me figure out why it doesn't respond to me upon the trigger @slang or !slang...

The network I've tried your script on is a nonstandard IRC network called Buzzen. If you know of it, you can go there and debug your script and see if this is a network related matter.
FordLawnmower   -  Nov 02, 2010
@Jethro_ it would still be helpful to understand what was causing your problems.
Any insight into this?
FordLawnmower   -  Nov 02, 2010
I just noticed the comments above.
Thanks for the help Jethro_, blackvenomm666 & TheImrac.
@startmeup If you insist on the very old version of mIRC, an edit of this for 6.16 is very simple, however, you may run in to an occasional error if there is a very long line.
Anyway this version Tested clean on XP with mIRC 6.16 -->> http://pastebin.com/eiGm9j9k
Keep in mind, as TheImrac pointed out, this is a bot script and must be triggered by a second mIRC client. You will not be able to see the output from the client this script is loaded into unless you use the alias.
FordLawnmower   -  Nov 02, 2010
Just tested this script clean on XP Pro with mIRC 7.1
Jethro   -  Nov 02, 2010
Thanks for the reply, Ford. I will modify your script for personal user without all those triggers to suit my needs. :-) As far as the workability goes, the /slang works 100%. I think I can manage from here.
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.