Word Definition

Platform:  mIRC
Published  Dec 14, 2011
Updated  Nov 02, 2013
Okay, so I just got 'round to changing this snippet too.

Usage: !define <word> (Remove the < >)

All comments/suggestions are welcome. :)

Example:
[2:00pm] <~Stewie> !define Example
[2:00pm] <&thunderbolt> Definition: a thing characteristic of its kind or illustrating a general rule Pronunciation: /ɪgˈzɑːmp(ə)l, ɛg-/
on $*:TEXT:/^!define( |$)/Si:#:{
if ($($+(%,defpro,$remove($chan,$chr(35))),5) == $null) {
define msg $chan $2-
set -u6 $+(%,defpro,$remove($chan,$chr(35))) Flood-Pro
}
else { .notice $nick This command can only be used once every 6 seconds. }
}
alias def define .echo -a $1-
alias define {
if ($sock(define)) sockclose define
sockopen define www.oxforddictionaries.com 80
sockmark define $1-
}
on *:sockopen:define:{
tokenize 32 $sock($sockname).mark
sockwrite -nt $sockname GET $+(/definition/english/,$lower($3)) HTTP/1.1
sockwrite -nt $sockname Host: $+($sock($sockname).addr,$str($crlf,2))
}
on *:sockread:define:{
var %define | sockread %define
if ($regex(%define,/definition">(.+?)</span>/)) hadd -m $sockname def $remove($regml(1),:)
if ($regex(%define,/key-to-pronunciation"> (.+?)</a></div>/)) hadd -m $sockname pro $regml(1)
if ($hget($sockname)) {
var %s = $sockname
$gettok($sock($sockname).mark,1-2,32) 04Definition: $hget(%s,def) 04Pronunciation: $hget(%s,pro)
hfree $sockname
sockclose $sockname
}
if (*Page not found* iswm %define) {
tokenize 32 $sock($sockname).mark
$gettok($sock($sockname).mark,1-2,32) No Results have been found for: $qt($3)
sockclose $sockname
}
}

Comments

Sign in to comment.
Chromatic   -  Nov 03, 2013
Did my update/fix help you? I know you just didn't know it wasn't working.. but it seems you adopted some of the minor changes I did to make it functional again.. except your url is *english* and not *american_english*.

I'm not an experienced IRC coder,.. but I decided to just take a stab at it and figured perhaps the website format had changed a bit.. and adjusted the URL but it didn't work exactly.. and added the "www" as well, and then it worked perfectly.

The Pronunciation is a neat feature, but I use this in a JTV chatroom, so I try to minimize any unnecessary information due to limited chat space. I also run Urban dictionary, as often the dictionary doesn't pick up the word -- especially if it is in an adverb/adjective format.. so I have it say " No Results have been found, please try !Urban (word)" for example. :)

Great and efficient script. Your coding looks quite good and not bloated (like mine would be). Do you code in anything else?
toclafane1  -  Nov 07, 2013
That's fine, if you ever feel the need to change something, feel free. I do not code in anything else, just mIRC really.

And, yeah... My code's have to look nice (I hate messy codes) :D
Sign in to comment

Chromatic   -  Oct 30, 2013
Thanks for script.

It stopped working over the last month or so..

I managed to correct it by modifying the following:

Code
 


and

Code
 


For any using it, and need to fix it to work with the new website layout of oxford.

Take care.
toclafane1  -  Nov 02, 2013
I updated the script, and it should be working with the British English Link. Hopefully that will solve any problems you have. Also, added pronunciation to the definitions as something extra. :)
Chromatic  -  Nov 02, 2013
You are awesome! Great script, you should really write more stuff. ;)
Sign in to comment

toclafane1   -  Nov 30, 2012
You're welcome. :)
 Respond  
mike_12212012   -  Nov 29, 2012
K that works :)

Thank You for your work !!
 Respond  
toclafane1   -  Nov 27, 2012
@Kiddo96 - I have added an alias: /def <word> ... Will echo it to your active window.
 Respond  
toclafane1   -  Nov 27, 2012
I use FireFox... Also seems I am getting the same issue, but when I re-coded this, I had no issue with it.

Edit: I think I have found the issue, the searching seems to be case sensitive.

[7:43pm] <~Stewie> !define smoke
[7:43pm] <&thunderbolt> Definition: a visible suspension of carbon or other particles in air, typically one emitted from a burning substance
and
[7:44pm] <~Stewie> !define Smoke
[7:44pm] <&thunderbolt> No Results have been found for: "Smoke"
Maybe the reason for the script not working, when you posted your first comment was because of this reason, I will post a fix around this soon.

Okay another post edit: Updated, so now should be fixed for that issue.
[11:04pm] <~Stewie> !define Smoke
[11:04pm] <&thunderbolt> Definition: a visible suspension of carbon or other particles in air, typically one emitted from a burning substance
[11:04pm] <~Stewie> !define smoke
[11:04pm] <&thunderbolt> Definition: a visible suspension of carbon or other particles in air, typically one emitted from a burning substance
 Respond  
mike_12212012   -  Nov 27, 2012
Tried in Opera, Firefox, IE and Chrome.

Mod mike_12212012: !define Smoke
Mod waffle_bot: No Results have been found for: "Smoke"
 Respond  
toclafane1   -  Nov 27, 2012
What browser are you using?
 Respond  
mike_12212012   -  Nov 25, 2012
Still not working :( It responds now but get this "No Results have been found for: "add word here""
 Respond  
toclafane1   -  Nov 20, 2012
Updated. @mike_12212012 - let me know if there is still a problem.
 Respond  
mike_12212012   -  Jul 14, 2012
As of 7/6/12 this script seems to not work anymore.
 Respond  
toclafane1   -  Jun 26, 2012
OK'. :)
 Respond  
ryan7461035   -  Jun 25, 2012
Nvm. it seems to be working now for me :)
 Respond  
toclafane1   -  Jun 24, 2012
What do you mean, is it not working for you?
 Respond  
ryan7461035   -  Jun 23, 2012
toclafane1 Can You Update this?
 Respond  
toclafane1   -  Dec 15, 2011
No, carry on, I don't mind. :p
 Respond  
Jethro   -  Dec 15, 2011
lol toclafane, I apologize for hijacking your thread for my vehement rant.
 Respond  
toclafane1   -  Dec 15, 2011
Thanks, and I will see what I can do.. :D
 Respond  
Kiddo96   -  Dec 15, 2011
For now, I'm giving this a 7. But if you could make a command /define -query- so it would work for your own mirc as an alias I can make it an 8 :-) Very good script!
 Respond  
toclafane1   -  Dec 15, 2011
I'm staying out of this.. :p
 Respond  
Jethro   -  Dec 15, 2011
Pardon me, jaytea, if I came out too harshly. It's just sometimes you spit out words like "not the same," or a line of sentence with nothing to explain. Perhaps I was being a bit selfish. Did you do that to me mainly? :/ I certainly am living proof that I've come across some of your posts made as such.
 Respond  
toclafane1   -  Dec 15, 2011
Lol
 Respond  
Fuzionx   -  Dec 15, 2011

how do you think a timed variable works internally? :P

Hehe you got a point there, didn't think of that. :P
 Respond  
jaytea   -  Dec 15, 2011
leaving people out in the cold? huh?

the question was purely rhetorical. a bit of banter between 2 coders. to spell out exactly what was (already strongly) implied is akin to a comedian explaining a joke for the special few who did not understand it after the audience's laughter has died down. i give Fuzionx more credit than that.
 Respond  
Jethro   -  Dec 15, 2011
Firstmate has a valid point. Instead of picking on each other, why don't each one of us be sincere and humble to assist one another without behaving like an egocentric person? jaytea, I truly expect that you will share your expertise in MSL field with explanation...not just leaving people out in the cold.
 Respond  
jaytea   -  Dec 14, 2011
Code
 


how do you think a timed variable works internally? :P
 Respond  
Firstmate   -  Dec 14, 2011
You guys are being so silly. He gave a legit suggestion. Stop provoking each other =\

Great script btw, it'd be cool to work in a few different sites like webster and stuff. I think a google, define: might give some better results.
 Respond  
Jethro   -  Dec 14, 2011
Precisely, toclafane, a person should never forget where he or she comes from.
 Respond  
toclafane1   -  Dec 14, 2011
There should be a dislike button, for comments you don't like... :p
 Respond  
toclafane1   -  Dec 14, 2011
Thanks Jethro. Also _Dean_, you were a newbie once, admit it.
 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.