!spell

By bl4h on Feb 07, 2006

Basically, this is a very fast public command spell checker.




Usage is




!spell




It has a 50 character word limit, and it will not process more than 1 query every 3 seconds (in case of flood).
It will search for an exact match. If it cant find an exact match, it will return suggestions. This is very fast. It uses dict.org, so your firewall must allow access to port 2628 on dict.org for it to work.



I updated the snippet to make it easier to configure. Youll find two lines that will allow yuo to change the messages from public/private and msg/notice

;Please credit:public spell checker by bl4h (joey@shady.nu) http://shady.nu

on *:sockopen:pdick:{ 
  if ($sockerr > 0) { 
    pssend Unable to connect to the spell server $+ ! Try again later.
    hfree pdic
    halt 
  }
}
alias pssend { $iif(%pspell.mess == 1,.msg,.notice) $iif(%pspell.type == 1,$hget(pdic,chan),$hget(pdic,nick)) $1- }

on *:TEXT:!spell*:#:{

  ;Message type: 1=msg 2=notice (change following line)
  %pspell.mess = 1
  ;Send messages to chan or private to the user: 1=public 2=private (change following line)
  %pspell.type = 1

  ;It will not proccess more than one spell check in 3 seconds (flood protection)
  if ($hget(pdic,string)) { msg $chan $nick , Search in progress. Please wait. | halt }
  if ($hget(pdicfld,flood) > 0) { halt }
  if (!$2) { msg $chan Usage: !spell <word> - Word must be less than 50 characters, and I will process only 1 query every 3 seconds. | halt }
  if ($len($2) > 50) { halt }
  if (!$hget(pdic)) { hmake pdic }
  if (!$hget(pdicfld)) { hmake pdicfld }
  hadd pdicfld flood 3
  hdec -c pdicfld flood
  hadd pdic string $2-
  hadd pdic db wn
  hadd pdic match 0
  hadd pdic chan $chan
  hadd pdic nick $nick
  if ($sock(pdick)) {
    smdic MATCH $hget(pdic,db) exact " $+ $hget(pdic,string) $+ "
  }
  if (!$sock(pdick)) { hadd pdic auth no | sockopen pdick dict.org 2628 }
}
alias smdic { sockwrite -n pdick $1- }
on *:sockread:pdick:{
  if ($sockerr > 0) { return }
  :nextread
  sockread %stalk
  if (%stalk == $null) { return }
  if ($sockbr == 0) { return }
  if ($left(%stalk,3) == 220 && $hget(pdic,auth) == no) { hadd pdic auth yes | smdic MATCH $hget(pdic,db) exact " $+ $hget(pdic,string) $+ " | halt } 
  if ($left(%stalk,3) == 220) { smdic CLIENT "mirc addon by bl4hster@gmail.com" | halt }
  if ($hget(pdic,catch) == 1) {
    %pdic.def = %pdic.def $gettok(%stalk,2,32)
  }
  if ($left(%stalk,3) == 552) {
    if ($hget(pdic,match) == 0) { 
      hadd pdic match 1
      %pdic.def = $hget(pdic,string) is 4INCORRECT. Suggestions:
      smdic MATCH $hget(pdic,db) lev " $+ $hget(pdic,string) $+ "
      halt
    }
    if ($hget(pdic,match) == 1) { 
      hadd pdic match 2
      smdic MATCH ! exact " $+ $hget(pdic,string) $+ "
      halt
    }
    if ($hget(pdic,match) == 2) {
      msg $hget(pdic,chan) %pdic.def NO MATCHES!
      hfree pdic
      halt
    }
  }
  if ($left(%stalk,3) == 420) { pssend Internal ERROR: Server temporarily unavailable }
  if ($left(%stalk,3) == 421) { echo -a !spell: Internal ERROR: Server shutting down at operator request }
  if ($left(%stalk,3) == 530) { pssend Internal ERROR: Access to server denied. }
  if ($left(%stalk,3) == 152) {
    if ($hget(pdic,match) == 0) { 
      pssend $hget(pdic,nick) $+ , $hget(pdic,string) is 3CORRECT
      hfree pdic
      halt
    }
    if ($hget(pdic,match) == 1 || $hget(pdic,match) == 2) {
      hadd pdic catch 1
    }
  }
  if (%stalk == .) {
    if ($hget(pdic,catch) == 1) {
      pssend %pdic.def
      hfree pdic
      halt
    }
  }
  return
  :error
  echo -s Weird !spell error. Clearing variables.
  hfree pdic
  sockclose pdick
  halt
}

Comments

Sign in to comment.
bl4h   -  Jun 17, 2013

Hi guys. I made this many years ago and it still works. let me explain how to get it working, hawkee has changed since it was uploaded. My suggestion is to create a file called "spell.mrc", or name it whatever you want, and copy this code into that file. save it, and simply type:

/load -rs spell.mrc

and it should load the script. you can easily open your mirc dir by typing "/run ."

yes... slash run dot

hope it helps!

also please dont edit the parts where it talks to dict.org. like CLIENT and my email. because they have rules for using the server and it has to be done correctly

 Respond  
LuminolBlue   -  Dec 13, 2011

3:31pm LuminolBlue: -spell Microsoft
3:31pm TestClient: Microsoft is INCORRECT. Suggestions: "microsoft"

This is an excellent script, it just needs one tiny feature. The ability to recognize words with proper capitalization. Note the example above. Perhaps someone would be kind enough to fix this?

 Respond  
Stewie1k94   -  Mar 14, 2011

awesome script i like it thanks

 Respond  
D3LTA   -  Feb 14, 2006

Great Script!

Can you make the output a notice instead of msg ??

Thanks in advanced!

 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.