English Slang Definition Checker

By Jethro on Sep 15, 2011

I see some of the slang checker scripts are not fully functional or unworkable, so I figure I'd give it a shot. [quote] !define dani

A person with lots of layers of goodness, like an onion without the crying and the smell. @define Hawkee Hawkee is undefined! !define smart alec A nicer way to say smart ass. You can use this in an office or when kids are around instead of saying smart ass or if you are a stick in the mud and don't cuss. [/quote]The command is self-explanatory and can be prefixed with !, @, or . to trigger. PM and channel supported. **- Fixed the line break characters being outputted.** **6/15/12 - Updated using urbandictionary.com's API link.** **10/20/12 - Updated a bit to remove \ character** ```mirc on *:sockopen:ud*:{ tokenize 32 $sock($sockname).mark if ($sockerr) { $5-6 Socket Error! halt } $2-4 GET $+(/v0/define?term=,$1) HTTP/1.0 $2-4 Host: $+($sock($sockname).addr,$str($crlf,2)) $2-4 Connection: close } on $*:text:/^[!@.]define( |$)/iS:*:{ if (!$($+(%,-,$site,.,$cid,.,$nick),2)) { inc -u3 $+(%,-,$site,.,$cid,.,$nick) var %ud = $+(ud,$str($ticks,3)) $+(sock,$iif($sock(%ud),close,open) %ud api.urbandictionary.com 80) sockmark %ud $replace($strip($2-),$chr(32),+) $& sockwrite -nt %ud .msg $iif(#,#,$nick) } } on *:sockread:ud*:{ sockread &ud tokenize 32 $sock($sockname).mark if ($sockerr) { $5-6 Socket Error! } elseif (no_results isin $bvar(&ud,1-).text) { $5-6 $qt($1) is undefined! } elseif ($regex($bvar(&ud,1-).text,/"definition":"(.*)/)) { tokenize 34 $regml(1) $gettok($sock($sockname).mark,5-6,32) $remove($regsubex($1,/\x5C(r|n{1,2})/gi,$chr(32)),\) } } ```
Sign in to comment.
toclafane1   -  Oct 20, 2012

Thanks mate. > [1:08am] <&thunderbolt> Early English term for

 Respond  
Jethro   -  Oct 20, 2012

toclafane1, I've updated the script. Please see to it.

incognitus  -  Feb 01, 2013

Thanks for the script, Jethro!

Can you edit this to work with mods only?

Thanks in advance.

Sign in to comment

toclafane1   -  Oct 20, 2012

Why do I keep getting "\" in the text? > [10:19pm] <&thunderbolt> Early English term for \

 Respond  
Jethro   -  Jun 28, 2012

turbuiance, the latest mIRC version automatically splits a long line of text into many chunk of sentences for you if it becomes too long. You can disable the function via mIRC options under IRC Messages at "Split long channel/query message" and then deselect it, BUT you many start to see it cut off (you won't be able to see the entire message) because a text line is too long that exceeds your chat server's message length. I'll suggest that you live with the message output to preserve the integrity of it.

 Respond  
turbuiance   -  Jun 28, 2012

can someone repost the change so it only spits out one line if its a long definition? So it doesnt keep breaking it up into several lines? thanks

 Respond  
RickyJames3211   -  Jun 23, 2012

Wow it works good thanks Jethro! ;)

 Respond  
Jethro   -  Jun 23, 2012

Here you go, Rick:

on $*:text:/^!define o(n|ff)$/iS:#:{
  if ($nick isop #) {
    if ($regml(1) == n) {
      if (!$istok(%chan,#,44)) {
        set %chan $addtok(%chan,#,44)
        .notice $nick # has been added!
      }
      else .notice $nick the channel $qt(#) has already been added!
    }
    else {
      if ($istok(%chan,#,44)) {
        set %chan $remtok(%chan,#,1,44)
        .notice $nick # has been removed.
      }
      else .notice $nick the channel $qt(#) has already been removed.
    }
  }
  else .notice $nick Access Denied. This command is reserved for OP only.
}
on *:sockopen:ud*:{ 
  tokenize 32 $sock($sockname).mark 
  if ($sockerr) { 
    $5-6 Socket Error! 
    halt 
  }
  $2-4 GET $+(/v0/define?term=,$1) HTTP/1.0
  $2-4 Host: $+($sock($sockname).addr,$str($crlf,2)) 
  $2-4 Connection: close
}
on $*:text:/^[!@.]define( |$)/iS:%chan,?:{
  if (!$($+(%,-,$site,.,$cid,.,$nick),2)) {
    inc -u3 $+(%,-,$site,.,$cid,.,$nick)
    var %ud = $+(ud,$str($ticks,3))
    $+(sock,$iif($sock(%ud),close,open) %ud api.urbandictionary.com 80)
    sockmark %ud $replace($strip($2-),$chr(32),+) $&
      sockwrite -nt %ud .msg $iif(#,#,$nick)
  }
}
on *:sockread:ud*:{
  sockread &ud
  tokenize 32 $sock($sockname).mark
  if ($sockerr) {
    $5-6 Socket Error!
  }
  elseif (no_results isin $bvar(&ud,1-).text) {
    $5-6 $qt($1) is undefined!
  }
  elseif ($regex($bvar(&ud,1-).text,/"definition":"(.*)/)) {
    tokenize 34 $regml(1)
    $gettok($sock($sockname).mark,5-6,32) $regsubex($1,/\Q\r\n\E/g,$chr(32))
  }
}
 Respond  
RickyJames3211   -  Jun 23, 2012

Okay Thanks. :)

 Respond  
Jethro   -  Jun 23, 2012

Ricky, I can add that feature just for you upon request, but I will leave the script the way it is.

 Respond  
RickyJames3211   -  Jun 21, 2012

Very Nice. Can you add a !define on/off swtich for OPS only.And Like Allowing it to be ON in one chan, but OFF in another.

 Respond  
MashhitDK   -  Jun 16, 2012

+1 Nice work as always...

 Respond  
incognitus   -  Jun 15, 2012

Thanks a lot, Jethro. Good work!

 Respond  
Jethro   -  Jun 15, 2012

I've updated the script using urbandictionary.com's API instead. I also removed the remde alias. Please see to it at your earliest convenience. Thanks for your likes and choosing my work.

 Respond  
MashhitDK   -  Jun 15, 2012

Am guessing your talking about the same thing as @incognitus Removed since script has been updated That's the same version as I PM'eD him... hope this helps @Kilim

 Respond  
Kilim   -  Jun 15, 2012

MasshitDK it works wonderfully, seriously. The only problem I encountered was when there is a super long definition. Can you shorten it to a max of 'x'' amount of characters, as an example? If not, thanks a bunch anyway, it did the charm~

 Respond  
MashhitDK   -  Jun 14, 2012

Don't think it's been cut... but I think I know what you mean... It's because it pulls more then one definition... a simple sockclose $sockname on line 12 in the above EDiT should do the trick. Have PM'eD you a edit where I've added the sockclose...

 Respond  
incognitus   -  Jun 14, 2012

Thanks MashhitDK, just the way i wanted. The only problem is that the definition gets cut a lot. I have another Slang Definition script and it doesnt cut like this one ;) it's just me or anyone else having this issue? Thanks again!!

 Respond  
MashhitDK   -  Jun 14, 2012

Simply add a @ to the on $:TEXT: event so it looks like this -> @$:TEXT:

on @$*:TEXT:/^[!@.]define( |$)/iS:*:{
  if (!$($+(%,-,$site,.,$cid,.,$nick),2)) && ($regex($nick($chan,$nick).pnick,/(!|~|&|@)/)) { inc -u3 $+(%,-,$site,.,$cid,.,$nick) | var %ud = $+(ud,$str($ticks,3))
  $+(sock,$iif($sock(%ud),close,open) %ud api.urbandictionary.com 80) | sockmark %ud $replace($strip($2-),$chr(32),+) sockwrite -nt %ud .msg $iif(#,#,$nick) }
}

Above will only work if the user is OP'eD (@) NOTE: Have "only" added the text event here... you'll need the rest of the script for it to work.

EDiT I might have misunderstood you... the above will only work if the bot / host ( client running the script ) is OP'eD (@) and come to think of it that wasn't what you asked for I'm guessing ?

on *:sockopen:ud*:{ tokenize 32 $sock($sockname).mark 
  if ($sockerr) { $5-6 Socket Error! | halt }
  $2-4 GET $+(/v0/define?term=,$1) HTTP/1.0
  $2-4 Host: $+($sock($sockname).addr,$str($crlf,2)) 
  $2-4 Connection: close
}
on $*:TEXT:/^[!@.]define( |$)/iS:*:{
  if (!$($+(%,-,$site,.,$cid,.,$nick),2)) && ($regex($nick($chan,$nick).pnick,/(!|~|&|@)/)) { inc -u3 $+(%,-,$site,.,$cid,.,$nick) | var %ud = $+(ud,$str($ticks,3))
  $+(sock,$iif($sock(%ud),close,open) %ud api.urbandictionary.com 80) | sockmark %ud $replace($strip($2-),$chr(32),+) sockwrite -nt %ud .msg $iif(#,#,$nick) }
}
on *:sockread:ud*:{ sockread &ud
  tokenize 32 $sock($sockname).mark
  if ($sockerr) { $5-6 Socket Error! }
  elseif (no_results isin $bvar(&ud,1-).text) { $5-6 $qt($1) is undefined! }
  elseif ($regex($bvar(&ud,1-).text,/"definition":"(.*)/)) { tokenize 34 $regml(1) | $gettok($sock($sockname).mark,5-6,32) $regsubex($1,/\Q\r\n\E/g,$chr(32)) }
  ;*** Use the one below and comment the one above out if you only want 1 line ( sockclose added to the one below )
  elseif ($regex($bvar(&ud,1-).text,/"definition":"(.*)/)) { tokenize 34 $regml(1) | $gettok($sock($sockname).mark,5-6,32) $regsubex($1,/\Q\r\n\E/g,$chr(32)) | sockclose $sockname }
}

The above will "only" work if the user is OP'eD (@) or above And have added a extra line with sockclose in case people only want the first definition.

 Respond  
incognitus   -  Jun 13, 2012

MashhitDK any way to set to Ops only? Thank you, and thanks Jethro!

 Respond  
MashhitDK   -  Jun 13, 2012

This should do the trick -> Removed since script has been updated Nothing has been changed besides link for look-up ;)

 Respond  
Kilim   -  Jun 11, 2012

Oh okay then. Kudos on the update then, when it comes out :)

 Respond  
Jethro   -  Jun 11, 2012

This script doesn't work anymore due to the change urbandictionary.com made. I'll have to update this script later.

 Respond  
Kilim   -  Jun 11, 2012

Odd. Copied everything over and it still doesn't function properly.

 Respond  
gooshie   -  Apr 16, 2012

Ricko, I modified the code as shown so i could simply /define [WORD] and it works so I'm suspecting you have other issues or are trying to trigger your own 'on text' event which is impossible.

on *:sockopen:ud*:{ 
  tokenize 32 $sock($sockname).mark 
  if ($sockerr) { $5-6 Socket error! | return }
  $2-4 GET $+(/iphone/search/define?term=,$1) HTTP/1.1
  $2-4 Host: $+($sock($sockname).addr,$str($crlf,2)) 
  $2-4 Connection: close
}
on *:sockread:ud*:{
  tokenize 32 $sock($sockname).mark
  if ($sockerr) { $5-6 Socket error! | return } | var %ud | sockread %ud
  if (undefined isin %ud) { $5-6 $qt($replace($1,+,$chr(32))) is $+($v1,!) }
  elseif ($regex(%ud,/"definition":"(.*)/)) { $5-6 $remde($gettok($regml(1),1,34)) }
}
alias define {
  set -l %ud $+(ud,$str($ticks,3))
  $+(sock,$iif($sock(%ud),close,open) %ud www.urbandictionary.com 80)
  sockmark %ud $replace($strip($1-),$chr(32),+) sockwrite -nt %ud .echo -a 
}
alias remde var %. | noop $regsub($1,/\134r\134n/g,$chr(32),%.) | return %.
 Respond  
RIcko   -  Apr 16, 2012

I have a completely new mIRC window for my bot, and the script is copied there already, no bracket mistakes or anything, but sitll doesn't work, could this be from the sockets or what?

 Respond  
gooshie   -  Apr 14, 2012

Ricko, You need to be in a clone or another instance to trigger the 'on Text' event or ask another chatter to try to trigger it.

 Respond  
RIcko   -  Apr 14, 2012

I copy pasted the script in my "remote" but when i do !define nothing happenes

 Respond  
Jethro   -  Sep 24, 2011

They English people have their own slang terms, which, to some extent, are different from Americans'

gooshie, the whole vernacular thing is a deep sought-after anthropological subject to read up upon or study of.

I think it's never easy enough to fake an English or American accent. It all comes down naturally when you were born to expose yourself to that particular culture to begin with.

 Respond  
Jethro   -  Sep 24, 2011

Thanks a lot for your patronage, gooshie. And much, much obliged with your high scoring.

 Respond  
gooshie   -  Sep 24, 2011

BTW Jethro nice socket bot script thingy. I gave it a 10 and a like. I didnt run it but it looks right and its been looked at enuff by now to know it works.

 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.