!Slang Urban Dictionary Script

Platform:  mIRC
Published  Mar 23, 2009
Updated  May 15, 2011
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 $!
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
}
#Slang on
On $*:Text:/^(\+|-|!|@)Slang.*/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
}
On *:sockopen:SlangUD*: {
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: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 $gettok($sock($sockname).mark,1-2,32) 1 $gettok(%SlangUD,-1,61)
sockclose $sockname
return
}
if (<div id='not_defined_yet'> isin %SlangUD) { $gettok($sock($sockname).mark,1-2,32) Sorry that word has yet to be defined. }
if (<td class='index'> isin %SlangUD) { 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(%SlangUD)) {
if (<span style='font-weight: normal'> !isin %SlangUD) { $gettok($sock($sockname).mark,1-2,32) 06Word -04 $censored($httpstrip(%SlangUD)) }
sockmark $sockname $puttok($sock($sockname).mark,0,6,32)
}
if ($regex(%SlangUD,/<div class=['"]([^>]*)['"]>/)) { sockmark $sockname $puttok($sock($sockname).mark,$regml(1),6,32) }
if ($gettok($sock($sockname).mark,6,32) == definition && $regex(def,%SlangUD,/<div class="definition">(.*)<div class="example">(.*)<\/div>/)) {
put $gettok($sock($sockname).mark,1-2,32) 06Definition -04 $censored($replace($httpstrip($regml(def,1)),$chr(13),$chr(32)))
put $gettok($sock($sockname).mark,1-2,32) 06Example -04 $censored($replace($httpstrip($regml(def,2)),$chr(13),$chr(32)))
}
if ($gettok($sock($sockname).mark,6,32) == example && $httpstrip(%SlangUD)) { put $gettok($sock($sockname).mark,1-2,32) 06Example -04 $censored($replace($v1,$chr(13),$chr(32))) }
if (<a href="/author.php?author= isin %SlangUD) {
put $gettok($sock($sockname).mark,1-2,32) 06Author -04 $censored($httpstrip(%SlangUD) - $+(07,http://www.urbandictionary.com,$gettok($sock($sockname).mark,3,32)))
sockclose $sockname
return
}
if (%SlangUD == <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;,",&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 $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
}
}
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 } }

Comments

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]
 Respond  
incognitus   -  Jun 13, 2012
Thanks FordLawnmower, it works great! Any chance to add Ops only? Thanks in advanced!
 Respond  
startmeup   -  Jan 21, 2012

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

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

Code

 

and replace it with

Code

 

Change NewbieGuy to what ever IRC nick you are using
 Respond  
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
 Respond  
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!
 Respond  
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?
 Respond  
FordLawnmower   -  Oct 20, 2011
Your welcome snackled :)
@NewbieGuy
From the Description:

Quote


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.
 Respond  
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.
 Respond  
snackled   -  Oct 19, 2011
Thank you so much...and wow, talk about a fast response :)
 Respond  
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
115:

Code

 

121:

Code

 

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.
 Respond  
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?
 Respond  
startmeup   -  Oct 10, 2011
Any chance of an on *:input:#: { for this script?..thanks in advance!
 Respond  
Donovan   -  May 07, 2011
nvm
 Respond  
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
 Respond  
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.
 Respond  
FordLawnmower   -  Nov 11, 2010
Thanks Slyvar :)
@startmeup no problem. I'm glad you got it working the way you want :)
 Respond  
startmeup   -  Nov 11, 2010
Just wanted to thank you for your help..script is great and working fine. nice work!
 Respond  
Slyvar   -  Nov 07, 2010
Thnaks Man you're Great

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

Code

 

I have it at line 56
Change it to:

Code

 


Your welcome MashhitDK :)
 Respond  
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 )
 Respond  
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
 Respond  
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.
 Respond  
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.
 Respond  
FordLawnmower   -  Nov 02, 2010
@Jethro_ it would still be helpful to understand what was causing your problems.
Any insight into this?
 Respond  
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.
 Respond  
FordLawnmower   -  Nov 02, 2010
Just tested this script clean on XP Pro with mIRC 7.1
 Respond  
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.
 Respond  
FordLawnmower   -  Nov 02, 2010
@Jethro_ No idea what your issue is here.
Just a guess on the !slang trigger. Is your bot a unregged nick and Jethro has usermode +R.
As for being missing most of the result , I'll be happy to try to debug this for you with a little more info.
mIRC Version
Windows Version
Country
IRC Daemon
Any other information that might be helpful.
As for user friendliness, I had a alias that returned Syntax etc. On error but I must have somehow pasted over it accidentally on the last update ;/
 Respond  
Jethro   -  Nov 02, 2010
Ok, I missed reading the instruction closely. Here is what I've done:

Quote

<@Jethro> +slang
<Bot> Jethro has activated the Slang script for %#testshack .
<@Jethro> +slang
<Bot> Jethro %#testshack is already running the Slang script
<@Jethro> !slang
waiting...
nothing...
<@Jethro> @slang
<Bot> Word - Bleh
<@Jethro> @slang
<Bot> Word - Hart
<@Jethro> @slang blah
<Bot> Word - blah
<@Jethro> @slang wut
<Bot> Word - wut
<@Jethro> @slang dickhead
<Bot> Word - Dickhead
<@Jethro> !slang
Nothing...
<@Jethro> !slang dickhead
Nothing...
<@Jethro> !slang
Again, nothing...
I'm not sure why. Could there be something I've missed out on the instruction? I think the trigger commands should be made more user-friendlier.
 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.