SpellCheckCommand
Script function world.SpellCheckCommand Read about scripting Type Method Summary Spell checks the text in the command window Prototype `long SpellCheckCommand(long StartCol, long EndCol);` View list of data type meanings Description `This function lets you call the MUSHclient spell-checker from a script to check the command window. The intention here is to let you filter out commands that would naturally fail the spell check, and only check ones you want. eg. "say xxx" You can specify a start and end column (these are 1-relative, that is the first column is column 1). You can use these to remove special words that might be at the start of the command. eg. SetRoomDesc "this is my description" In this case you might make an plugin that matches on: SetRoomDesc "*" Inside the plugin you could work out the start and end column for the "real" text and specify that for the spell checker. If the start column or the end column is less than 1, or the end column is not greater than the start column, then the entire command window will be checked. eg. to check the entire command window: SpellCheckCommand (0, 0) The function returns: -1 : spell check engine not initialised successfully 0 : spell check cancelled 1 : spell check completed OK The spell checking is done with the currently-configured spell-check options (eg. whether words in capitals are checked, whether duplicates are checked). If there is a spelling error in the selected text, a GUI window will pop-up requesting corrective action. The the Lua example below for a suggested way of conditionally spellchecking certain commands. Make a plugin, and in that plugin put the function OnPluginCommand. This is called every time you send a command to the MUD. In the script below it does a regular expression check to find what command you have entered. In the example if you "say" or "tell" something, then the "something" part (the captured pattern) is sent to SpellCheckCommand with the start and end column being those from the regular expression capture. If the check fails, it returns false to stop sending the command. If the check succeeds, it gets the command text from the command window, in case the spell check changed it. If it changed, it returns false to stop *this* command being sent, and does a "Send" of the modified one. If it didn't change (ie. no spelling errors at all, or the errors were ignored) then the original command is allowed to proceed.` VBscript example
    result = SpellCheckCommand (5, 20)

    if result = 0 then
      Note "spelling error detected"
    end if
Lua example
    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
Return value
    -1 : spell check engine not initialised successfully

    0 : spell check cancelled (cancel button pressed)

    1 : spell check completed OK (possibly after amending the text in the window)
See Also ... Topic Spell checker Functions AddSpellCheckWord (Adds a word to the user spell check dictionary) SpellCheck (Spell checks an arbitrary string of text) SpellCheckDlg (Spell checks an arbitrary string of text, invloking the spell-checker dialog) (Help topic: function=SpellCheckCommand) Documentation contents page