Definition Script

Platform:  mIRC
Published  Feb 06, 2010
Updated  Feb 06, 2010
This snippet defines stuff (duh) using define, definition, or def. I know there's other ones but I wanted to post mine :P. Thanks to Scakk for one of the $replace lines and Jethro_ for the regex statement. Gooshie fixed the regex up a little more too. on $*:text:/^[!.@]def(ine|inition)? \w+$/Si:#:{
if (!$sock(definition)) {
set %definitionword $2
set %defchan $chan
msg # Looking up results for $+([,$chr(3),12,%definitionword,$chr(15),],:)
sockopen definition lookwayup.com 80
}
}
on *:sockopen:definition: {
sockwrite -n $sockname GET /lwu.exe/lwu/d?s=f&w= $+ %definitionword HTTP/1.1
sockwrite -n $sockname Host: lookwayup.com
sockwrite -n $sockname Connection: Close
sockwrite -n $sockname $crlf
}
on *:sockread:definition: {
sockread %define
if (not found. isin %define) { msg %defchan No results found for $+([,$chr(3),12,%definitionword,$chr(15),],.) | sockclose definition }
if (Spelling corrected isin %define) { msg %defchan No results found for $+([,$chr(3),12,%definitionword,$chr(15),],.) | sockclose definition }
if ($chr(90) isin %define) && ($chr(91) isin %define) { set %definition $nohtml(%define) | set %defyesono yes | set %defyes yes }
elseif (%defyesono == yes) { msg %defchan $gettok(%definition,1,46) $+ $chr(46) $+($chr(91),$chr(3),7,$gettok($gettok(%definition,1,93),2,91),$chr(15),$chr(93)) $remove($replace($nohtml(%define),$("),$chr(34),$('),$chr(39)),$chr(9)) | unset %defyesono }
}
on *:sockclose:definition: {
if (%defyes == yes) { msg %defchan End of results for $+([,$chr(3),12,%definitionword,$chr(15),],.) | unset %def* }
}
alias nohtml {
var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;)
return %x
}

Comments

Sign in to comment.
Battlemonkey   -  Feb 07, 2010
@above Not sure what you mean by that, but I'm fine with what I have now. Thank you anyways. :)
 Respond  
tonobungay   -  Feb 07, 2010
For tips on a more efficient way to do it, drop an e-mail to info @ lookwayup.com There are ways to retrieve the definitions without all the formatting and ads.
 Respond  
Battlemonkey   -  Feb 06, 2010
Update: Added the $nohtml alias which should have been there.
 Respond  
`Dean   -  Feb 06, 2010
Lol, haha.

Thanks
 Respond  
Battlemonkey   -  Feb 06, 2010
...:o IT'S A LIE! /me blushes
 Respond  
Jethro   -  Feb 06, 2010
I can imagine what you can do behind those piles of papers in private...
 Respond  
Battlemonkey   -  Feb 06, 2010
Shhh... That's a secret. /me hides
 Respond  
FordLawnmower   -  Feb 06, 2010
@Battlemonkey You should put mIRC away and clear some of those papers off of your desk :P
 Respond  
Battlemonkey   -  Feb 06, 2010
@`Dean Not sure what happened. Try placing it in a new remote.

@The rest of you. O_o I'll study that and figure it out :P.
 Respond  
napa182   -  Feb 06, 2010
lol
 Respond  
Jethro   -  Feb 06, 2010
Ok gooshie's is shorter. :p
 Respond  
napa182   -  Feb 06, 2010
here is one way of making it
trigger @def <word> <number of def's> Ex:" @def cat 2 " to message the channel
or " !def cat 2 " to notice the user

Code

 


Just one of many ways to make this.

also one way to replace them &#34; i did

Code

 

in my version
but if you wanted to use it as a alias you can do

Code

 

that way you dont need to do all them $replace(%define,&#44,$chr(44)) and so on you can just do $rchr(%define) or w/e you use to hold the info.
 Respond  
`Dean   -  Feb 06, 2010
I tried to run it, here's the results?

[13:06] <~`Dean> .define fact
[13:06] <~exHelp> Looking up results for [fact]:
[13:06] <~exHelp> . []
[13:06] <~exHelp> . []
[13:06] <~exHelp> . []
[13:06] <~exHelp> . []
[13:06] <~exHelp> End of results for [fact].
 Respond  
Battlemonkey   -  Feb 06, 2010
lol more regex. ok then.
 Respond  
gooshie   -  Feb 06, 2010

Code

 
 Respond  
Battlemonkey   -  Feb 06, 2010
Sockmark? Not sure what that is... Could you please give me an example?
 Respond  
napa182   -  Feb 06, 2010
also look into using sockmark so you don't have to set global vars.

as well if you are going to use $regex why not use $regml as well?
also the script is a bit floody maybe make it notice instead of msg or have it list a number of results like maybe 3
cuz !def cat gave back 10 lines thats more then enough to get you banned from some channels.
 Respond  
Battlemonkey   -  Feb 06, 2010
Thanks Jethro_. Just started regex :P.
 Respond  
Jethro   -  Feb 06, 2010
battlemonkey, your regex can be alternated to this:

Code

 
No need to match every word by def, define, or definition itself.
 Respond  
ImArrow   -  Feb 06, 2010
no problem
 Respond  
Battlemonkey   -  Feb 06, 2010
Thanks :)
 Respond  
ImArrow   -  Feb 06, 2010
Very clean cut Script, then again i didnt test it, but eyeballingit it seems decent. nice 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.