Is there a way to only perform spellchecking on certain commands? Basically, I only want to perform spellchecking on certain commands that match a set pattern.
Basically, only if the command starts with 'say' or ':' or ';'. Everything else is OOC and I don't want it spellchecked, unless I specifically invoke it, of course.
Too late! You will burn on the stake! I don't know about a spellcheck function, but if there is one it will be easy to make an alias to spellcheck... Nick will have to talk about that.
One annoying problem with spell check is not only that it can't be set to only work in specific cases, but it also spellchecks everything. You may 'want' it to spellcheck say, 'house' when it is in a sentence and you mispell it, but not when it is by itself or as a series of stacked commands. (I actually aliased huose, because for some damn reason I mistype it everytime if I am in a hurry. lol) Same with any other commands, or even channel names. You can tell it to exclude some stuff by adding it to the dictionary, but that isn't always going to work. A better solution would be an option for aliases like "spellcheck wildcards", so you can make an alias for say, the hypothetical 'fkl' channel, which only test the wildcard contents you type after. Which basically helps to solve both issues.
So, are we talking about a spellcheck function that returns the string after spellcheck?
that way we can do something like this:
fkl (.*)
send fkl Spellcheck(%1)
or whatever?
Youd just be able to call this as a sub, I assume it would require (or at least, be redundant if you didnt) spellcheck to be off globally.
Hmm. That's an idea. I was thinking more in terms of it being an option, not something you have to explicitely call in script. Though, likely a script accessable one 'and' an option that just turns it on for the alias would be most likely.
Basically, in the case of aliases, you type:
fkl blah
That alias is 'fkf *' and there is an option for "spellcheck wildcard contents before using". But access to spellcheck from in scripting may be nice to have as well.
For my purposes, Shadowfyr's sugguestion of a 'spellcheck wildcards' option would be almost good enough for most cases. If there was a function somewhere that would spellcheck the given text passed to it then return the corrected text, that would solve any complicated or weird sort of things I come up with.
Basically, there's just too many commands, acrnyms, odd chunks of words, and other such things for me to enjoy adding them all to dictionarys. Especially since some(many) of them are things which may easily be mistyped in normal "RP" text that i'd want caught.. so, they are only "misspelled" given context.
I tried to make this work with existing scripting, but failed. Basically you can DoCommand "SpellCheck" but by the time the spell check is executed the command window has been emptied.
I think I will have to put in a special function which allows you to spellcheck arbitrary text (eg. the wildcards).
Cool. :) And, again, sorry for posting it in the wrong forum. Meant to click on 'General', off by one!
No pressure of course, but is this something you may find yourself interested in doing in the next revision or two? Or is it a 'pie-in-the-sky' thing :) Just curious. If its something you don't feel like adding for awhile I might think about some other way to accomplish it in the meantime. Maybe a ':' and 'say' alias that send to a script, and I trigger some kind of spellcheck in an external comobject or something, then send back to the world... hmm.
You could perhaps make an alias that matches on "sp *" and you could do "sp say hello", and the alias would toggle spellchecking on, World.Execute the %1, and toggle it off again. This of course is a bit crude and it would take some practice, but I think it would do what you want.
could you have have it cycle twice? first time send to command, turn spell check on, then somehow push it through?
then disable it.
How would one force the enter? I suppose it might require a double return on anything you want spellchecked. But, thats not really a problem considering if anything is spelled incorrectly youve got a dialog.
This is now implemented in version 3.54, in two different ways.
First is SpellCheck - a function that checks any arbitrary string of text.
Example, in Lua:
result = SpellCheck (
"Twas brillig, and the slithy toves Did gyre and gimble in the the wabe")
print (type (result))
if result == nil then
Note "Spell check not available"
elseif result == 0 then
Note "No spelling errors"
else
for _, v in result do print (v) end
end
-- output:
table --> type of result
Twas
brillig
gimble
slithy
the the --> duplicated word
toves
wabe
You can use that to do any custom spellchecking that you like. It returns an array of the "bad" words, which you could conceivably filter against (eg. maintain your own list of custom words).
Next there is SpellCheckCommand - this invokes the GUI spellchecker for the current command in the command window. However unlike the existing spellchecker, you can make this conditional.
The neatest way of doing this is to use the functionality of the OnPluginCommand plugin callback. This is called every time you send a command. By capturing the command here we can apply a regular expression to it (the example below only spellchecks "say" and "tell") and also limit the spell checking to certain columns. This would be useful to discard initial "command" words that you don't want spellchecked.
function OnPluginCommand (sText)
a, b, c = rex.new ("(?:say|tell) (.+)"):exec (sText)
if a == nil then
return true -- not matched our regular expression
end -- if
-- matched regular expression - check the command
check = SpellCheckCommand (c [1], c [2])
-- if check failed, cancel sending
if check == 0 then
return false -- cancelled, don't process
end
-- if command hasn't changed, allow it to go
if GetCommand () == sText then
return true
end
-- get the amended command, send that instead
Send (GetCommand ())
return false
end