Top

!Slang


mIRC Code
+ 0 likes
Please Register to submit score.
Bookmark and Share
Average Score  7.5 (of 2 scores)
Date Added  Aug 13, 2007
Last Updated  Sep 23, 2007
Tags  dictionary  slang  urban 

Introduction

Version 1.1

UPDATED!
I added flood protection so any regular user in a channel can't use it more than 3 times in 30 seconds.


This script can be used to look up a slang word definition from Urban Dictionary.
Usage: !slang 1 word
(This retrives the first result for *word* of 53 results.) i.e. 1/53
!slang 2 word
(Retrives the second result for *word*.) i.e. 2/53
!Random (Retrives a random slang word)
!Related Word (finds up to 10 words with a similar meaning to word)
!Nearby Word (finds 10 words listed nearby word alphabetically)
!wod retrives todays Word Of the Day.
!spell word (uses google suggest function which isn't all that great imo)
!slanghelp will list usage examples.

Since this script uses my web sites resources I would appreciate a link to http://www.MyWebs.biz/ in exchange for me allowing others to use my bandwidth and resources. If you have a web page somewhere please put up a link to my site using *My Webs* as the link text. (without the *'s) Example HTML code is included in the script up top! Thank You!

Most of this scripts logic is written in PHP, on my web site, that uses SOAP to connect to Urban Dictionary's API. This IRC script mostly just passes the variables via GET variables to my web page. This is where the real work is done.

One known bug: When you look up a word with an apostrophe ' it won't return any results when it should. Its not that big of a deal since not many words have an ' in them. If anyone can solve this please comment below.

This IRC script also uses another persons socket code. URL: http://www.mircscripts.com/cgi-bin/file.php?id=897 This code is mostly left unchanged. It doesn't always properly split the message into small enough chunks and you won't always see the whole thing that gets returned because its too long. If anyone finds a fix for this please comment the script and I will update the IRC script code.
WARNING: Urban Dictionary is not appropriate for all audiences! Slang words often contains curse words!
Thank You,
MyWebs



Grab the Code

;*****************************************************************************************************;
;***  !slang  script                                                                               ***;
;***  © Anthony Goodley & www.Mywebs.biz                                                           ***;
;***  If you have a web site please link back to my site in exchange for me allowing others to use ***;
;***  my bandwidth and resources. If you don't know HTML use the line below:                       ***;
;***  <a href="http://www.mywebs.biz/">My Webs</a>                                                 ***;
;***  or                                                                                           ***;
;***  <a href="http://www.mywebs.biz/">MyWebs</a>                                                  ***;
;***  I prefer this first one but I want some of both.                                             ***;
;***  Thank You! :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :) :)  ***;
];*****************************************************************************************************;
 
 
alias Test123 {
  /request example2 http://ramirez.avalanchestudios.net/test.php $chan 12
}
on *:TEXT:!Spell *:#: {
  if ($nick isreg #) { inc -u30 %SpellIgnore. [ $+ [ $nick ] ] }
  if (%SpellIgnore. [ $+ [ $nick ] ] = 4 ) { msg $chan 4,2 $nick 11,2I Will Now Ignore your Commands For 30 Seconds. | halt }
  if (%SpellIgnore. [ $+ [ $nick ] ] >= 5 ) { halt }
  set %Ascspell  $replace($2-,$chr(32),$chr(37) $+ 20)
  set %SpellChan $chan
  set %SpellChanShort $right(%SpellChan, -1)  
  set %SpellURL http://www.mywebs.biz/IRC/Spell.php?search= $+  %Ascspell
  set %SpellURL2 %SpellURL $+ &Server=
  set %SpellURL3 %SpellURL2 $+ $server
  set %SpellURL4 %SpellURL3 $+ &Channel=
  set %SpellURL5 %SpellURL4 $+ %SpellChanShort
  /request example2 %SpellURL5 $chan 11,2
  unset %Ascspell
  unset %SpellChan
  unset %SpellChanShort
  unset %SpellURL
  unset %SpellURL2
  unset %SpellURL3
  unset %SpellURL4
  unset %SpellURL5
}
 
on 10:TEXT:!Slanghelp:#: {
  msg $chan 11,2 !Slang 1 word (retrives result #1/53 for word) **** !Related Word (finds up to 10 words with a similar meaning to word) **** !Nearby Word (finds 10 words listed nearby word alphabetically) !WOD (Retrives the Word Of the Day) !Random (Retrives a random slang word)
}
on *:TEXT:!Random:#: {
  if ($nick isreg #) { inc -u30 %RandomIgnore. [ $+ [ $nick ] ] }
  if (%RandomIgnore. [ $+ [ $nick ] ] = 4 ) { msg $chan 4,2 $nick 11,2I Will Now Ignore your Commands For 30 Seconds. | halt }
  if (%RandomIgnore. [ $+ [ $nick ] ] >= 5 ) { halt }
  set %RandomChan $chan
  set %RandomChanShort $right(%RandomChan, -1)  
  set %RandomURL http://www.mywebs.biz/IRC/Random.php
  set %RandomURL2 %RandomURL $+ ?Server=
  set %RandomURL3 %RandomURL2 $+ $server
  set %RandomURL4 %RandomURL3 $+ &Channel=
  set %RandomURL5 %RandomURL4 $+ %RandomChanShort
  /request example2 %RandomURL5 $chan 11,2
  unset %RandomChan
  unset %RandomChanShort
  unset %RandomURL
  unset %RandomURL2
  unset %RandomURL3
  unset %RandomURL4
  unset %RandomURL5
}
 
on *:TEXT:!WOD:#: {
  if ($nick isreg #) { inc -u30 %WODIgnore. [ $+ [ $nick ] ] }
  if (%WODIgnore. [ $+ [ $nick ] ] = 4 ) { msg $chan 4,2 $nick 11,2I Will Now Ignore your Commands For 30 Seconds. | halt }
  if (%WODIgnore. [ $+ [ $nick ] ] >= 5 ) { halt }
  set %WODChan $chan
  set %WODChanShort $right(%WODChan, -1)  
  set %WODURL http://www.mywebs.biz/IRC/WOD.php
  set %WODURL2 %WODURL $+ ?Server=
  set %WODURL3 %WODURL2 $+ $server
  set %WODURL4 %WODURL3 $+ &Channel=
  set %WODURL5 %WODURL4 $+ %WODChanShort
  /request example2 %WODURL5 $chan 11,2
  unset %WODChan
  unset %WODChanShort
  unset %WODURL
  unset %WODURL2
  unset %WODURL3
  unset %WODURL4
  unset %WODURL5
}
 
 
on *:TEXT:!Nearby *:#: {
  if ($nick isreg #) { inc -u30 %NearbyIgnore. [ $+ [ $nick ] ] }
  if (%NearbyIgnore. [ $+ [ $nick ] ] = 4 ) { msg $chan 4,2 $nick 11,2I Will Now Ignore your Commands For 30 Seconds. | halt }
  if (%NearbyIgnore. [ $+ [ $nick ] ] >= 5 ) { halt }
  set %Asc4  $replace($2-,$chr(32),$chr(37) $+ 20)
  set %NearbyChan $chan
  set %NearbyChanShort $right(%NearbyChan, -1)
  set %NearbyURL http://www.mywebs.biz/IRC/Nearby.php?Word= $+  %Asc4
  set %NearbyURL2 %NearbyURL $+ &Server=
  set %NearbyURL3 %NearbyURL2 $+ $server
  set %NearbyURL4 %NearbyURL3 $+ &Channel=
  set %NearbyURL5 %NearbyURL4 $+ %NearbyChanShort
  /request example2 %NearbyURL5 $chan 11,2
  unset %Asc4
  unset %NearbyChan
  unset %NearbyChanShort
  unset %NearbyURL
  unset %NearbyURL2
  unset %NearbyURL3
  unset %NearbyURL4
  unset %NearbyURL5
}
on *:TEXT:!Related *:#: {
  if ($nick isreg #) { inc -u30 %RelatedIgnore. [ $+ [ $nick ] ] }
  if (%RelatedIgnore. [ $+ [ $nick ] ] = 4 ) { msg $chan 4,2 $nick 11,2I Will Now Ignore your Commands For 30 Seconds. | halt }
  if (%RelatedIgnore. [ $+ [ $nick ] ] >= 5 ) { halt }
  set %Asc5 $replace($2-,$chr(32),$chr(37) $+ 20)
  set %RelatedChan $chan
  set %RelatedChanShort $right(%RelatedChan, -1)
  set %RelatedURL http://www.mywebs.biz/IRC/Related.php?Word= $+  %Asc5
  set %RelatedURL2 %RelatedURL $+ &Server=
  set %RelatedURL3 %RelatedURL2 $+ $server
  set %RelatedURL4 %RelatedURL3 $+ &Channel=
  set %RelatedURL5 %RelatedURL4 $+ %RelatedChanShort
  /request example2 %RelatedURL5 $chan 11,2
  unset %Asc5
  unset %RelatedChan
  unset %RelatedChanShort
  unset %RelatedURL
  unset %RelatedURL2
  unset %RelatedURL3
  unset %RelatedURL4
  unset %RelatedURL5
}
on *:TEXT:!Slang *:#: {
  if ($nick isreg #) { inc -u30 %SlangIgnore. [ $+ [ $nick ] ] }
  if (%SlangIgnore. [ $+ [ $nick ] ] = 4 ) { msg $chan 4,2 $nick 11,2I Will Now Ignore your Commands For 30 Seconds. | halt }
  if (%SlangIgnore. [ $+ [ $nick ] ] >= 5 ) { halt }
  if ($2 !isnum) { /msg $chan $nick  $2 is not a number. Enter a number for the number of the result you want. i.e !slang 1 $2- | halt }
  set %Asc2 $replace($3-,$chr(32),$chr(37) $+ 20)
  ;set %Asc2 $replace($3-,$chr(32),+)
  set %Asc3 $replace(%Asc2,$chr(39),$chr(37) $+ 27)
  ;set %Asc3 $replace(%Asc2,$chr(39),% $+ 27)
  ;/msg $chan Variable Asc3: %Asc3
  set %SlangURLS http://www.mywebs.biz/IRC/Slang.php?Word= $+  %Asc3
  set %SlangURLS2 %SlangURLS $+ &Count=
  set %SlangURLS3 %SlangURLS2 $+ $$2
  set %SlangURLS4 %SlangURLS3 $+ &Server=
  set %SlangURLS5 %SlangURLS4 $+ $server
  set %SlangChan $chan
  set %SlangChanShort $right(%SlangChan, -1)
  set %SlangURLS6 %SlangURLS5 $+ &Channel=
  set %SlangURLS7 %SlangURLS6 $+ %SlangChanShort
  /request example2 %SlangURLS7 $chan 11,2
  unset %Asc2
  unset %Asc3
  unset %SlangURLS
  unset %SlangURLS2
  unset %SlangURLS3
  unset %SlangURLS4
  unset %SlangURLS5
  unset %SlangURLS6
  unset %SlangURLS7
  unset %SlangChan
  unset %SlangChanShort
}
/*
The script below is someone elses. It doesn't always properly split the message into
small enough chunks for mIRC. If anyone finds a fix for this please comment the script and I will
update the code. Thank You.
*/
;---------------------------------------;
; HTTP Request Script by ramirez © 2005 ;
;---------------------------------------;
; Usage: /request signal url [info]     ;
; -                                     ;
; This script will send a HTTP request  ;
; for the specified URL and then call   ;
; your SIGNAL event for every line the  ;
; HTTP request returns.                 ;
;                                       ;
; The passed parameters to the signal   ;
; are the following:                    ;
;                                       ;
;  $1  The status for the signal:       ;
;        0: Error                       ;
;        1: Line Output                 ;
;        2: Start Output                ;
;        3: End Output                  ;
;                                       ;
; In case of Error:                     ;
;   $2  Error number                    ;
;   $3- Error message                   ;
;                                       ;
; In case of Line Output:               ;
;   $2- The line of output from request ;
;                                       ;
; NOTE.                                 ;
;   If you give the additional info     ;
;   parameter, $2-N will always be the  ;
;   info you want to send to the signal ;
;   and the parameters listed above are ;
;   pushed after the info parameters    ;
; -                                     ;
; See examples of usage below,          ;
; in bottom of the file                 ;
;---------------------------------------;
 
alias request {
  var %id = $1, %url = $2, %info = $3-
  if (!%id || !%url) { return }
  if (!$regex(%url, /^(http:\/\/)?([^:/]+)(:(\d+))?(/.*)?$/i)) { return }
  var %host, %port = 80, %path = /, %matches = $regml(0), %i = 1
  if ($regml(%i) == http://) { inc %i }
  %host = $regml(%i)
  if (%matches > %i) {
    inc %i
    if ($left($regml(%i), 1) == /) { %path = $regml(%i) }
    else {
      inc %i
      %port = $regml(%i)
      if (%matches > %i) {
        inc %i
        %path = $regml(%i)
      }
    }
  }
  var %largest = 0, %total = $sock(req1123476767*, 0)
  %i = 1
  while (%i <= %total) {
    var %conn = $right($sock(req1123476767*, %i).name, -13)
    if (%conn isnum) {
      if (%conn > %largest) {
        %largest = %conn
      }
    }
    inc %i
  }
  inc %largest
  var %name = req1123476767 $+ %largest
  hmake %name 5
  hadd %name id %id
  hadd %name info %info
  hadd %name header $true
  hadd %name chunked $false
  hadd %name request $&
    GET %path HTTP/1.1 $+ $crlf $+ $&
    Host: %host $+ : $+ %port $+ $crlf $+ $&
    Connection: Close $+ $crlf $+ $crlf
  sockopen %name %host %port
}
 
on 1:sockopen:req1123476767*:{
  var %id = $hget($sockname, id)
  if ($sockerr) {
    .signal %id 0 $hget($sockname, info) $sock($sockname).wserr $sock($sockname).wsmsg
    hfree $sockname
    return
  }
  .signal %id 2 $hget($sockname, info)
  sockwrite $sockname $hget($sockname, request)
}
 
on 1:sockread:req1123476767*:{
  var %temp, %id = $hget($sockname, id), %chunked = $false, %read, %len
  if ($sockerr) {
    .signal %id 0 $hget($sockname, info) $sock($sockname).wserr $sock($sockname).wsmsg
    hfree -w $sockname
    return
  }
  while ($true) {
    sockread -f %temp
    if ($sockbr == 0) { break }
    if ($hget($sockname, header)) {
      if (%temp == Transfer-Encoding: chunked) { hadd -m $sockname chunked $true }
      elseif (%temp == $null) { hadd -m $sockname header $false }
    }
    elseif (%temp != $null) {
      if ($hget($sockname, chunked)) {
        if (%chunked) {
          inc %read $calc($sockbr + 2)
          if (%read >= %len) { %chunked = $false }
          .signal %id 1 $hget($sockname, info) %temp
        }
        else {
          %read = 0
          %len = $base($gettok(%temp, 1, 32), 16, 10)
          %chunked = $true
        }
      }
      else {
        .signal %id 1 $hget($sockname, info) %temp
      }
    }
  }
}
 
on 1:sockclose:req1123476767*:{
  var %id = $hget($sockname, id)
  .signal %id 3 $hget($sockname, info)
  hfree $sockname
}
 
; EXAMPLES OF USAGE
; -
; Try with these to see some examples:
; -
; EXAMPLE #1 - Without Optional Info (echo's to active window)
; /request example1 http://ramirez.avalanchestudios.net/test.txt
; /request example1 http://ramirez.avalanchestudios.net/test.php
; -
; EXAMPLE #2 - With Optional Info (msg's to specified channel with specified color)
; /request example2 http://ramirez.avalanchestudios.net/test.txt #test 4
; /request example2 http://ramirez.avalanchestudios.net/test.php #test 12
; -
; NOTE. If you want to use the Example #2 examples above, join #test first!
;       Otherwise change the #test to some other channel you are on!
;       You can view the source of test.php at:
;       http://ramirez.avalanchestudios.net/test.phps
; -
; Or with your own file!
 
; EXAMPLE #1 CODE
; -
on *:SIGNAL:example1:{
  var %status = $1
  if (%status == 0) {
    ; ERROR!
    var %errno = $2, %errstr = $3-
    echo 4 -a ERROR ( $+ %errno $+ ): %errstr
  }
  if (%status == 1) {
    ; OUTPUTTING A LINE
    echo 2 -a $2-
  }
  if (%status == 2) {
    ; STARTING DATA OUTPUT
    echo 3 -a --- DATA START ---
  }
  if (%status == 3) {
    ; ENDING DATA OUTPUT
    echo 3 -a --- DATA END ---
  }
}
 
; EXAMPLE #2 CODE
; -
on *:SIGNAL:example2:{
  var %status = $1, %chan = $2, %color = $3
  if (%status == 0) {
    ; ERROR!
    var %errno = $4, %errstr = $5-
    ;echo 4 -a ERROR ( $+ %errno $+ ): %errstr
  }
  if (%status == 1) {
    ; OUTPUTTING A LINE
    ;msg %chan $+($chr(3), %color, $4-, $chr(3))
    msg %chan  $+ %color $4-
  }
 
  ; You can also notice that start/end of output
  ; are optional to handle!
}

Comments

  (10)  RSS
napa182
Comments: 1,454
 
mIRC Snippet:  !Slang
Posted on Aug 13, 2007 3:00 am
woot about time Tony =P .. I love the script it rocks.
MyWebs
Comments: 3
 
mIRC Snippet:  !Slang
Posted on Aug 13, 2007 11:00 am
Thanks napa182.
I'd like to clarify one point. If you look up a word and see more than 1 result returned you can look up each and every result one at a time.
For example if you type !Slang 1 bed ... you will see:

(1/8)-bed **Definition** a matress on a stand or on the floor (lol) that has a blanket and pillows on it and u got to sleep on it coz sleep is so good **Example** im gonna go hit the sac... then im gonna go to bed ;) **Author** flash **URL** http://www.urbandictionary.com/define.php?term=bed&defid=778262 [782]

That 8 means there are 8 entries for bed. To see the next result you can type !Slang 2 bed all the way up to !slang 8 bed. Some Slang words have hundreds of entries. They are ranked by most votes.
Some entries are quite long and will flood ur channel. Not much I can do about that really. lol
Thanks,
MyWebs
MyWebs
Comments: 3
 
mIRC Snippet:  !Slang
Posted on Sep 23, 2007 4:33 am
I upgraded !Slang so it now has flood protection.
I don't think it was probably a problem really but its there now.
MyWebs
mountaindew
Comments: 1,826
 
mIRC Snippet:  !Slang
Posted on Apr 10, 2008 2:31 pm
You could just "unset %slang* %related*" etc
Phoenix847
Comments: 13
 
mIRC Snippet:  !Slang
Posted on May 21, 2008 6:33 pm
Actually, this can still be used for spam. My friend did "!slang 2 Noob" and a lot of messages starting appearing in the channel and eventually led to Excess Flood.
Could you make it possible on !slang it will do a ".notice $nick"
And on a @slang it will do a ".msg $chan"

That would be greatly appreciated, and I say the . before msg/notice as it won't flood me, if you didn't know that :p
napa182
Comments: 1,454
 
mIRC Snippet:  !Slang
Posted on May 21, 2008 6:42 pm
well it all depends on how long the first deff for the slang is. some are longer then others and will flood, but on the msg and notice part you can change ur self but on the php side of things it will stay the same.
Phoenix847
Comments: 13
 
mIRC Snippet:  !Slang
Posted on May 21, 2008 6:56 pm
Yes, but I've never tried to script PHP or learn it at least lol. I'm totally lost with it.
But from the random testing of just trying stuff, I've found Line 149 - " /request example2 %SlangURLS7 $chan 4,1", if you change $chan to $nick, it will PM the person instead... My only problem is changing it do a .notice message.
However for the messaging $chan part... thats simple, leave it the same and change !slang to @slang =/ BUT I still need it to be .msg
So Napa, as smart as you are, you might be able to give me a hint :P
napa182
Comments: 1,454
 
mIRC Snippet:  !Slang
Posted on May 21, 2008 8:49 pm
um you wont beable to change the php side of this script cuz it's not on here. Tony has this set up to send the info to his page then it pulls it from there to mirc.
but you can replace the !slang part with this
Code:
 on *:TEXT:!Slang *:#: {
  if ($2 !isnum) { .notice $nick  $2 is not a number. Enter a number for the number of the result you want. i.e !slang 1 $2- | halt }
  set %slangchan2 $chan
  set %slangnick $nick
  set %Asc2  $replace($3-,$chr(32),$chr(37) $+ 20)
  ;set %Asc2  $replace($3-,$chr(32),+)
  set %Asc3  $replace(%Asc2,$chr(39),$chr(37) $+ 27)
  ;set %Asc3  $replace(%Asc2,$chr(39),% $+ 27)
  ;/msg %slangchan2 Variable Asc3: %Asc3
  set %SlangURLS http://www.mywebs.biz/IRC/Slang.php?Word= $+  %Asc3
  set %SlangURLS2 %SlangURLS $+ &Count=
  set %SlangURLS3 %SlangURLS2 $+ $$2
  ;/msg %slangchan2 URL: %SlangURLS3
  /request example2 %SlangURLS3 %slangchan2 11,2
  unset %slang* %Asc*
}


napa182
Comments: 1,454
 
mIRC Snippet:  !Slang
Posted on May 21, 2008 8:51 pm
you need to find this in the socketread part and use this
Code:
elseif (%temp != $null) {
      if ($hget($sockname, chunked)) {
        if (%chunked) {
          inc %read $calc($sockbr + 2)
          if (%read >= %len) { %chunked = $false }
          .notice %slangnick $hget($sockname, info) %temp
        }
        else {
          %read = 0
          %len = $base($gettok(%temp, 1, 32), 16, 10)
          %chunked = $true
        }
      }
      else {
        .notice %slangnick $hget($sockname, info) %temp
      }
    }
  }
}

that should make it notice
uneek
Comments: 26
 
mIRC Snippet:  !Slang
Posted on Jul 11, 2008 1:20 am
Thanks mate! Been looking for one that works with the sites new updates for a while! It was a very popular script in a channel of mine :D

I added a link to your site as well to show my support. http://www.mydamnsig.com

Commenting Options

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

  
Bottom