Spellcheck socket

By Tsuiseki on Mar 21, 2008

~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


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


Echoes the results of the spell checking to the active window. This is the default script.

  • Any problems/questions/concerns can be either posted here or sent to me by email: criticallia@gmail.com

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) }


Sign in to comment.
Render   -  Apr 01, 2008

not a bad little snippet, but you might want to get rid of the if (

) event as it serves no purpose judging by the looks of your code. you also might want to try shortening the number of global variables as much as possible, use the sockmark command and $gettok!
Tsuiseki   -  Mar 22, 2008

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.


DarkNES   -  Mar 22, 2008

Script works just fine for me. Pretty nice for those who can\'t spell at all. 9/10.

Tsuiseki   -  Mar 21, 2008

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


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.