!spell

By FordLawnmower on Mar 21, 2009

Simple spell check script. It has a public trigger -- !spell word and a private alias -- /spell word. There is a on/off switch for the public trigger on the channel menu.
Image

;Spell Check by Ford_Lawnmower irc.GeekShed.net #Script-Help
menu Channel,Status {
  .$iif($group(#SpellCheck) == On,$style(1)) SpellCheck Trigger
  ..$iif($group(#SpellCheck) == On,$style(2)) On: .enable #SpellCheck
  ..$iif($group(#SpellCheck) == Off,$style(2)) Off: .disable #SpellCheck
}
#SpellCheck on
On $*:Text:/^(\+|-|!|@)Spell(Check)?.*/Si:#: {
  var %action $regml(1)
  if (%action isin +-) && ($regex($nick($chan,$nick).pnick,/(!|~|&|@)/)) {
    if (%action == +) {
      if ($istok(%SpellCheckChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is already running the SpellCheck script }
      else { 
        .enable #SpellCheck
        Set %SpellCheckChanList $addtok(%SpellCheckChanList,$+($network,$chan),32)
        .msg $chan $nick has activated the SpellCheck script for $chan .
      }
    }
    else {
      if (!$istok(%SpellCheckChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is not running the SpellCheck script }
      else { 
        Set %SpellCheckChanList $remtok(%SpellCheckChanList,$+($network,$chan),1,32)
        .msg $chan $nick has deactivated the SpellCheck script for $chan . 
      }
    }
  }
  elseif (!$timer($+(SpellCheck,$network,$nick))) && ($istok(%SpellCheckChanList,$+($network,$chan),32)) {
    .timer $+ $+(SpellCheck,$network,$nick) 1 6 noop
    var %method $iif(%action == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%|\+)/),.msg $chan,.notice $nick))
    GetSpellCheck %method $$2
  }
}
#SpellCheck end
alias SpellCheck { GetSpellCheck echo -a $1 }
alias -l GetSpellCheck {
  $1-2 Searching........
  var %sockname $+(SpellCheck,$network,$2,$ticks)
  sockopen %sockname www.phigita.net 80
  sockmark %sockname $1-2 $+(/spell-check/word-suggest?q=,$3)
}
On *:sockopen:SpellCheck*: {
  if (!$sockerr) {
    sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
    sockwrite -n $sockname Host: www.phigita.net
    sockwrite -n $sockname $crlf
  }
  else { sockclose $sockname | return }
}
On *:sockread:SpellCheck*: {
  if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
  else {
    var %SpellCheck | sockread %SpellCheck
    if ($regex(%SpellCheck,/("[^"]*" is spelled correctly)/i)) { 
      $gettok($sock($sockname).mark,1-2,32) $regml(1)
      ;sockclose $sockname
      ;return
    }
    elseif ($regex(%SpellCheck,/("[^"]*" is misspelled)/i)) $gettok($sock($sockname).mark,1-2,32) $regml(1)
    elseif ($regex(match,%SpellCheck,/q=define:([\w]*)"/gi)) { 
      $gettok($sock($sockname).mark,1-2,32) Suggestions: $regsubex($str(.,$regml(match,0)),/(.)/g,$+($iif(\n > 1,$chr(44)),$regml(match,\n)))
      sockclose $sockname
      return
    }
    elseif (</html> isin %SpellCheck) {
      $gettok($sock($sockname).mark,1-2,32)  Nothing Found!
      sockclose $sockname
    }
  }
}

Comments

Sign in to comment.
FordLawnmower   -  Nov 29, 2010

That is not my script Dark| , you must have an old script loaded that is calling /spell .
Mine only calls /GetSpellCheck .
You will probably have to search your loaded scripts and unload the one that is causing the error.

 Respond  
Dark|   -  Nov 28, 2010

it dosent work :/
SPELL Unknown command
and the bot wont do !spell

__>

 Respond  
Jethro   -  Nov 07, 2010

MashhitDK, you know there is a big difference between no-lifer and lifesaver. Even though you're joking, that slang word no-lifer won't justify Ford's continuous, enthusiastic assistance. He doesn't do this for gratuity but volunteerism's sake.

 Respond  
MashhitDK   -  Nov 07, 2010

Uhhh... nice work... ooO( I didn't expect you to be so fast you no-lifer ;P hehe <3 )

[size=16]BIG THANKs[/size]
Much appreciated Ford....

  • 1 LoVE !?!

EDIT
Works just like intended...
Once again thanks for fixing it ooO( SO FAST! ) :D
EDIT 2:
"OFF-TOPIC?/REPLY?"
I'm sure he doesn't do it for gratuity... he does it for all the punani of-cause ???
Haha... joke a side...
I do appreciate it... ( whatever Ford / or others intentions are / where ) and since time isn't something we have...
I think the least I can do... is to take the time to show My appreciation...
ooO( Anybody who takes the time to help others are A-OK in My book )
"BACK-2-TOPIC?/REPLY?"
But yeah... you are absolutely right Jethro_... regarding the no-life'er comment at least, and
[size=16]I apologize for the bad joke[/size] [size=18]<3[/size]

 Respond  
FordLawnmower   -  Nov 07, 2010

Updated
Basic version of this script with no colors.
+-spell to turn the script off/on in a channel.
@spell word - to message the result to the channel (voices or higher)
!spell word - will notice the user.
Suggestions will be given even if the word is spelled correctly. I will make this an option when I update it tomorrow.
I will also update the description and add some other options.

 Respond  
FordLawnmower   -  Nov 07, 2010

I took a quick look at this and it's not salvageable. The pages it used do not even exist anymore. I'll post a basic working replacement in just a few and then I will update it further tomorrow.

 Respond  
MashhitDK   -  Nov 07, 2010

Thanks for it FordLawnmower :D

That would be much appreciated ;D hehe <3

 Respond  
FordLawnmower   -  Nov 07, 2010

Seems to be broken MashhitDK. I'll have a look at it a little later and post an update a.s.a.p.

 Respond  
MashhitDK   -  Nov 06, 2010

Not working or is it just Me ?

  • Tried a couple now... and can't get any of them working...
    Just tried this... and on My first search on catd it came up with "No match was found for *** bla bla "
    And when I did it again same thing happened with weed and cat
 Respond  
FordLawnmower   -  Sep 20, 2009

It's a really old script ataraxia. I had completely forgotten I wrote it ;/
I'll add it to my list of scripts to be re-written and I'll change the flood protection in the re-write.

 Respond  
ataraxia   -  Mar 23, 2009

sif, joshface. A simple per-nickname flood protection would make the script more useful. Josh = fool.

 Respond  
napalm`   -  Mar 23, 2009

Nick = Fool :]

 Respond  
FordLawnmower   -  Mar 22, 2009

You could easily make this work for simultaneous usage. You would need to also add additional trigger flood protection. Keeping in mind that each instance of a script like this is opening a socket to the internet, I never make sockets scripts that allow for multiple instances to run at the same time. With the exception, of course, being a real time translation script :)
I tested that $iif Aucun50 , it works :)

 Respond  
ataraxia   -  Mar 22, 2009

Perhaps the global variables could be replaced with a more dynamic data type, so that you could allow multiple simultaneous users? Just my two cents. :]

 Respond  
Aucun50   -  Mar 22, 2009

Not sure that $iif statement will work.

 Respond  
FordLawnmower   -  Mar 22, 2009

;/ I missed that ;/ I changed the spell.spellout. I left the spell.clear global because I added a line to use it from the menu in case it needs reset for some reason.
Just incase the script stopped for some reason before it cleared all the variables.

  .$iif((!%spell.inuse),$style(2)) Reset Trigger: spell.clear
 Respond  
Kirby   -  Mar 22, 2009

You also might want to add the -l (meaning local) switches in

alias spell.spellout

and

alias spell.clear

, and perhaps put the alias /spell in front so that people (who don't read descriptions) don't confuse themselves with the proper alias.

 Respond  
FordLawnmower   -  Mar 22, 2009

It gets lots of use in my chans Aucun50.
Thanks Kirby :) I see lots of scripters using that method, However when I do it, I always end up answering the question "How do you turn the trigger on?" Over and Over.
I think the proper method would be to disable it by default, but..........
No Idea why mIRC makes you reverse Off and On to make a script work properly. It even turns the groups back on when you make a change and save the edited remote ;/

 Respond  
Kirby   -  Mar 22, 2009

You might want to change

#SpellTrigger On

to

#SpellTrigger Off

because when it is loaded, it is automatically turned on..or did you mean to do that?

(Another) very nice script, but I find it interesting how you use many different local aliases towards a simple socket script. Nice to see different kinds of coders here.

 Respond  
Aucun50   -  Mar 22, 2009

Looks handy

 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.