I'm trying to implement spellchecks for certain inputs only, like says, poses, <whatever>, but not anything else like movement-commands and such. Initially, I did that using Nick's OnPluginCommand-example, but it turns out I can't have the input parsed by my aliases and OnPluginCommand at the same time, so I promptly upgraded to 3.75 and started using OnPluginCommandEntered instead.
The problem I'm having now is, I can't find a way to abort the sending of the text without also wiping the input from the input-buffer permamently, no way to get it back. I'd like to be able to cancel the spellcheck to add/remove something, without having to rewrite the entire <whatever>.
Right now, I have this Lua stuffed into a plugin:
function OnPluginCommandEntered (sText)
a, b, c = rex.new ("(?:say |:|spoof |ooc |page \w+|whisper \w+)(.+)"):exec (sText)
if a == nil then
return sText -- not matched our regular expression
end
-- matched regular expression - check the command
check = SpellCheckCommand (c [1], c [2])
-- if check failed, cancel sending
if check == 0 then
SelectCommand()
PasteCommand(sText)
return '\t' -- cancelled, don't process
end
-- get the amended command, send that instead
return GetCommand ()
end
Any suggestions? |