Word Definition

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

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

All comments/suggestions are welcome. :) 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 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>/)) {
$gettok($sock($sockname).mark,1-2,32) Definition: $remove($regml(1),:)
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.
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.

Quote

[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

Quote

[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.

Quote

[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

Quote


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  
_Dean_   -  Dec 14, 2011
1 - if you will remove all the HTML tags, doesnt need to put $null
2 - if you will use tokenize, why did you use $gettok so? instead using $1 $2 and $3?
3 - you dont need to do a lot of vars like on hhfree alias... just return the value of all the commands
4 - there is no reason to use alias GetDefineSearch when you can do the same command on the on text event
5 - no need to use timers, and then do a noop command just to flood control
6 - whats the reason for the $ticks on $regsubex, if you will not call the $regsubex name after?
7 - you are a newbie, accept the advices
8 - if you want to make it a challenge, we can short it a lot, check my example, shorter and with some modifications

Code

 
 Respond  
Jethro   -  Dec 14, 2011
Keep up the good work.
 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.