~Spellcheck socket by Tsuiseki
As the name suggests, this snippet will check the spelling of a word by socketing to www.spellcheck.net. If you misspell a word it will offers the suggestions that the site offers. The script can be used on a bot and for personal use; see below for details.
~Bot use & Syntax
!spellcheck
Simply messages the channel the script was triggered on the results. This part of the script is optional, and by default, is disabled. If you wish to use the bot script, make sure to remove the / and / before and after the on text event to use this!
~Personal use & Syntax
/spellcheck
Echoes the results of the spell checking to the active window. This is the default script.
Enjoy the script!
; -------------------------------------------------
; Spellcheck! by Tsuiseki/Ken (critcallia@gmail.com)
; Written & Tested in mIRC version 6.31
; -------------------------------------------------
; There are a couple ways to use this:
; -------------
; 1) Bot
; -
; Syntax: (!@)spell(check) <word>
; Messages the channel or notices the nick the results.
; By default, it will notice the nick the results, however, using @spell(check) <word> will message the channel.
; * In order to use this, remove the /* and */ before and after the bot code
; -------------
; 2) Alias
; -
; Syntax: /spellcheck <word>
; Echoes the results into the active window.
; --------------------------------------------------
; * If you misspell a word, it will offer suggestions.
; * Any problems, you mail email me or post a comment!
; --------------------------------------------------
; Updates
; -------------
; 1) Fixed the code, it kept storing previous html in the $addtok
; 2) Added a regex for the trigger, as some channels don't like direct messages
; --------------------------------------------------
/*
on $*:text:/^[!@]spell(check)?/Si:#:{
if (!$sock(sc)) {
set %sctemp $iif(! isin $1,notice $nick,msg #)
sockopen sc spellcheck.net 80
sockmark sc $2
}
else msg # $nick $+ , the spellchecker is in use. Try again in a few seconds.
}
*/
alias spellcheck {
if ($1) {
sockopen sc spellcheck.net 80
sockmark sc $1
echo -atc info Looking up $1 $+ ...
set %sctemp echo -tc info $iif($active != Status Window,$active)
}
else {
echo -atc info2 Provide something to spellcheck!
}
}
on *:sockopen:sc:{
sockwrite -nt $sockname GET /cgi-bin/spell.exe?action=CHECKWORD&string= $+ $sock($sockname).mark HTTP/1.1
sockwrite -nt $sockname Host: spellcheck.net
sockwrite -nt $sockname $crlf
}
on *:sockread:sc:{
var %sr
sockread %sr
if (*correctly* iswm %sr) {
%sctemp $sock($sockname).mark is spelled correctly!
unset %sctemp | sockclose sc
}
if (<BLOCKQUOTE> iswm %sr) set %sctemp2 true
if (</BLOCKQUOTE> iswm %sr) {
%sctemp $sock($sockname).mark is misspelled. Here are some suggestions: $+(%sctemp3,.)
unset %sctemp*
sockclose sc
}
if (*<BR> iswm %sr) && (<*>*<BR> !iswm %sr) { set %sctemp3 $addtok(%sctemp3,$remove(%sr,<BR>),44) }
}
Thanks DarkNES!
I\'ve also added another update. The script now has a regex trigger to display the results two different ways. If you use the !spellcheck trigger it will notice the nick; if you use the @spellcheck trigger, it will message the channel. This is because some channels don\'t like public scripts.
~Tsuiseki
.. Update:
I just discovered a small error with that seemed to be occurring. What was happening was previous html from matching correctly spelled results seemed to be added with $addtok. I\'m not sure if others have been receiving this error, but I have been. So, I\'ve just added another if comparison just to make sure that it didn\'t happen. Sorry to all that have been receiving this error, if you have.
~Tsuiseki