Scripting return codes

Below is a list of the error codes that are returned by many script routines. Some scripts return different codes (such as variants), see those functions for more information.

The English meaning (eg. "The world is already open") can also be obtained by calling the ErrorDesc script function. The descriptions corresponding to an error code can also be found in Lua by indexing into the error_desc table (as in the "check" function below).

There is a function built into the Lua script space which will check for errors automatically:

function check (result)
  if result ~= error_code.eOK then
    error (error_desc [result] or 
           string.format ("Unknown error code: %i", result), 
           2) -- error level - whoever called this function
  end -- if
end -- function check 
If you pass an error code to the "check" function it will raise an error if the code is not valid (ie. not zero), with the appropriate error message. For example:

check (WindowShow ("foo", true))   -- raises error if window "foo" does not exist
The error codes can also be accessed from Lua using the error_code table (eg. error_code.eOK, error_code.eCannotPlaySound).
MnemonicValueMeaning
eOK0No error
eWorldOpen30001The world is already open
eWorldClosed30002The world is closed, this action cannot be performed
eNoNameSpecified30003No name has been specified where one is required
eCannotPlaySound30004The sound file could not be played
eTriggerNotFound30005The specified trigger name does not exist
eTriggerAlreadyExists30006Attempt to add a trigger that already exists
eTriggerCannotBeEmpty30007The trigger "match" string cannot be empty
eInvalidObjectLabel30008The name of this object is invalid
eScriptNameNotLocated30009Script name is not in the script file
eAliasNotFound30010The specified alias name does not exist
eAliasAlreadyExists30011Attempt to add a alias that already exists
eAliasCannotBeEmpty30012The alias "match" string cannot be empty
eCouldNotOpenFile30013Unable to open requested file
eLogFileNotOpen30014Log file was not open
eLogFileAlreadyOpen30015Log file was already open
eLogFileBadWrite30016Bad write to log file
eTimerNotFound30017The specified timer name does not exist
eTimerAlreadyExists30018Attempt to add a timer that already exists
eVariableNotFound30019Attempt to delete a variable that does not exist
eCommandNotEmpty30020Attempt to use SetCommand with a non-empty command window
eBadRegularExpression30021Bad regular expression syntax
eTimeInvalid30022Time given to AddTimer is invalid
eBadMapItem30023Direction given to AddToMapper is invalid
eNoMapItems30024No items in mapper
eUnknownOption30025Option name not found
eOptionOutOfRange30026New value for option is out of range
eTriggerSequenceOutOfRange30027Trigger sequence value invalid
eTriggerSendToInvalid30028Where to send trigger text to is invalid
eTriggerLabelNotSpecified30029Trigger label not specified/invalid for 'send to variable'
ePluginFileNotFound30030File name specified for plugin not found
eProblemsLoadingPlugin30031There was a parsing or other problem loading the plugin
ePluginCannotSetOption30032Plugin is not allowed to set this option
ePluginCannotGetOption30033Plugin is not allowed to get this option
eNoSuchPlugin30034Requested plugin is not installed
eNotAPlugin30035Only a plugin can do this
eNoSuchRoutine30036Plugin does not support that subroutine (subroutine not in script)
ePluginDoesNotSaveState30037Plugin does not support saving state
ePluginCouldNotSaveState30037Plugin could not save state (eg. no state directory)
ePluginDisabled30039Plugin is currently disabled
eErrorCallingPluginRoutine30040Could not call plugin routine
eCommandsNestedTooDeeply30041Calls to "Execute" nested too deeply
eCannotCreateChatSocket30042Unable to create socket for chat connection
eCannotLookupDomainName30043Unable to do DNS (domain name) lookup for chat connection
eNoChatConnections30044No chat connections open
eChatPersonNotFound30045Requested chat person not connected
eBadParameter30046General problem with a parameter to a script call
eChatAlreadyListening30047Already listening for incoming chats
eChatIDNotFound30048Chat session with that ID not found
eChatAlreadyConnected30049Already connected to that server/port
eClipboardEmpty30050Cannot get (text from the) clipboard
eFileNotFound30051Cannot open the specified file
eAlreadyTransferringFile30052Already transferring a file
eNotTransferringFile30053Not transferring a file
eNoSuchCommand30054There is not a command of that name
eArrayAlreadyExists30055That array already exists
eBadKeyName30056That name is not permitted for a key
eArrayDoesNotExist30056That array does not exist
eArrayNotEvenNumberOfValues30057Values to be imported into array are not in pairs
eImportedWithDuplicates30058Import succeeded, however some values were overwritten
eBadDelimiter30059Import/export delimiter must be a single character, other than backslash
eSetReplacingExistingValue30060Array element set, existing value overwritten
eKeyDoesNotExist30061Array key does not exist
eCannotImport30062Cannot import because cannot find unused temporary character
eItemInUse30063Cannot delete trigger/alias/timer because it is executing a script
eSpellCheckNotActive30064Spell checker is not active
eCannotAddFont30065Cannot create requested font
ePenStyleNotValid30066Invalid settings for pen parameter
eUnableToLoadImage30067Bitmap image could not be loaded
eImageNotInstalled30068Image has not been loaded into window
eInvalidNumberOfPoints30069Number of points supplied is incorrect
eInvalidPoint30070Point is not numeric
eHotspotPluginChanged30071Hotspot processing must all be in same plugin
eHotspotNotInstalled30072Hotspot has not been defined for this window
eNoSuchWindow30073Requested miniwindow does not exist
eBrushStyleNotValid30074Invalid settings for brush parameter

Ready-to-paste declarations for each scripting language are on the return codes page.

Topic