Register forum user name Search FAQ

MUSHclient scripting

Description of MUSHclient world function: world.SpellCheck


Name SpellCheck
Type Method
Summary Spell checks an arbitrary string of text
Prototype VARIANT SpellCheck(BSTR Text);
Description

This function lets you call the MUSHclient spell-checker from a script on any arbitrary text string.

Note that if the spell-check engine has not been initialised (eg. the DLL is not present, or the spell check dictionary is not there), it returns the Empty variant (or nil in Lua).

You supply a string of text to be checked.

If there are no spelling errors, the number zero is returned.

If there are spelling errors, a variant array of all of the misspelt words is returned. You can then iterate through that array to display the misspelt words.

If your spell checker has been configured to detect duplicates (eg. "a bird in the the hand") then they will be returned as duplicated words in the list (eg. "the the"). You could detect that by looking for a space in the returned word.

The spell checking is done with the currently-configured spell-check options (eg. whether words in capitals are checked, whether duplicates are checked).

There is no GUI interface (that is, no "correct this word") dialog box will appear.


Note: Available in version 3.54 onwards.


VBscript example
result = SpellCheck _
  ("Twas brillig, and the slithy toves Did gyre and gimble in the the wabe")

Note vartype (result) ' array of variants will be 8204

if vartype (result) = (vbArray + vbVariant) then
  For Each w In result
      world.note w
    Next
elseif IsEmpty (result) then
  Note "Spell check not available"
else
  Note "No spelling errors"
end if
Lua example
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 pairs (result) do print (v) end
end
Returns If the spell checker is not available an Empty variant (or nil in Lua).

If there were no spelling errors, a numeric result of zero.

If there were spelling errors, a variant array consisting of each misspelt word. If the same word was misspelt twice, it is only returned once. The array of misspelt words is in alphabetic order.
Introduced in version 3.54

See also ...

Function Description
AddSpellCheckWord Adds a word to the user spell check dictionary
SpellCheckCommand Spell checks the text in the command window
SpellCheckDlg Spell checks an arbitrary string of text, invloking the spell-checker dialog

Search for script function

Enter a word or phrase in the box below to narrow the list down to those that match.

The function name, prototype, summary, and description are searched.

Search for:   

Leave blank to show all functions.


Return codes

Many functions return a "code" which indicates the success or otherwise of the function.

You can view a list of the return codes


Function prototypes

The "prototype" part of each function description lists exactly how the function is called (what arguments, if any, to pass to it).

You can view a list of the data types used in function prototypes


View all functions

[Back]

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.