Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Lua ➜ Built-in constants

Built-in constants

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Wed 24 Nov 2004 08:48 AM (UTC)

Amended on Mon 14 Nov 2005 08:29 PM (UTC) by Nick Gammon

Message
To make it easier to write scripts, MUSHclient's Lua interface has various built-in tables of constants.



Trigger flags for AddTrigger

These are in the 'trigger_flag' table.

Example:


table.foreach (trigger_flag, print)

-- output:

RegularExpression 32
Temporary 16384
ExpandVariables 512
LowercaseWildcard 2048
OmitFromLog 2
IgnoreCase 16
Replace 1024
Enabled 1
OmitFromOutput 4
KeepEvaluating 8





Alias flags for AddAlias

These are in the 'alias_flag' table.

Example:


table.foreach (alias_flag, print)

-- output:

Enabled 1
Temporary 16384
ExpandVariables 512
AliasMenu 8192
IgnoreAliasCase 32
RegularExpression 128
Replace 1024
OmitFromLogFile 64
AliasQueue 4096
AliasSpeedWalk 2048





Timer flags for AddTimer

These are in the 'timer_flag' table.

Example:


table.foreach (timer_flag, print)

-- output:

Enabled 1
Temporary 16384
OneShot 4
TimerNote 16
TimerSpeedWalk 8
ActiveWhenClosed 32
AtTime 2
Replace 1024





Custom colour flags for AddTrigger

These are in the 'custom_colour' table.

Example:


table.foreach (custom_colour, print)

-- output:

Custom8 7
Custom4 3
Custom2 1
Custom1 0
Custom9 8
Custom13 12
Custom11 10
CustomOther 16
Custom3 2
Custom5 4
Custom7 6
NoChange -1
Custom12 11
Custom16 15
Custom15 14
Custom14 13
Custom6 5
Custom10 9




Error codes - map error names to numbers

These are in the 'error_code' table.

You can use these to check individual error codes.

eg.


if AddTimer (blah blah blah) == error_code.eTimerAlreadyExists  then
  error ("That timer already exists")
end


Example:


table.foreach (error_code, print)

-- output:

eCommandNotEmpty 30020
eAliasCannotBeEmpty 30012
eCannotImport 30062
eKeyDoesNotExist 30061
eBadRegularExpression 30021
ePluginDisabled 30039
eSetReplacingExistingValue 30060
eInvalidObjectLabel 30008
eCannotLookupDomainName 30043
eVariableNotFound 30019
eTriggerSequenceOutOfRange 30027
eArrayNotEvenNumberOfValues 30057
eLogFileBadWrite 30016
ePluginCouldNotSaveState 30037
eImportedWithDuplicates 30058
eCannotCreateChatSocket 30042
eNoSuchRoutine 30036
eBadParameter 30046
eWorldOpen 30001
eFileNotFound 30051
eErrorCallingPluginRoutine 30040
eLogFileNotOpen 30014
eTimerNotFound 30017
eTriggerNotFound 30005
ePluginFileNotFound 30030
eArrayDoesNotExist 30056
eArrayAlreadyExists 30055
eCannotPlaySound 30004
eWorldClosed 30002
eAlreadyTransferringFile 30052
eNotTransferringFile 30053
eNoSuchCommand 30054
eNoChatConnections 30044
eAliasAlreadyExists 30011
eTimeInvalid 30022
eUnknownOption 30025
eClipboardEmpty 30050
eNoSuchPlugin 30034
eCouldNotOpenFile 30013
eOK 0
eBadMapItem 30023
eChatAlreadyConnected 30049
eChatIDNotFound 30048
eChatAlreadyListening 30047
ePluginCannotGetOption 30033
eAliasNotFound 30010
ePluginDoesNotSaveState 30037
eBadDelimiter 30059
eCommandsNestedTooDeeply 30041
eChatPersonNotFound 30045
eNoMapItems 30024
eNotAPlugin 30035
ePluginCannotSetOption 30032
eProblemsLoadingPlugin 30031
eTriggerAlreadyExists 30006
eNoNameSpecified 30003
eTimerAlreadyExists 30018
eTriggerLabelNotSpecified 30029
eLogFileAlreadyOpen 30015
eTriggerSendToInvalid 30028
eScriptNameNotLocated 30009
eTriggerCannotBeEmpty 30007
eOptionOutOfRange 30026





Error codes - map error codes to descriptions

These are in the 'error_desc' table.

You can use these to give meaningful error messages.

eg.


status = AddTimer ("a", 0, 0, 0, 0, 0)
if status ~= error_code.eOK  then
  error (error_desc [status]) -->  Time given to AddTimer is invalid
end


Example:


table.foreach (error_desc, print)

-- output:

30001 The world is already open
30002 The world is closed, this action cannot be performed
30003 No name has been specified where one is required
30004 The sound file could not be played
30005 The specified trigger name does not exist
30006 Attempt to add a trigger that already exists
30007 The trigger "match" string cannot be empty
30008 The name of this object is invalid
30009 Script name is not in the script file
30010 The specified alias name does not exist
30011 Attempt to add a alias that already exists
30012 The alias "match" string cannot be empty
30013 Unable to open requested file
30014 Log file was not open
30015 Log file was already open
30016 Bad write to log file
30017 The specified timer name does not exist
30018 Attempt to add a timer that already exists
30019 Attempt to delete a variable that does not exist
30020 Attempt to use SetCommand with a non-empty command window
30021 Bad regular expression syntax
30022 Time given to AddTimer is invalid
30023 Direction given to AddToMapper is invalid
30024 No items in mapper
30025 Option name not found
30026 New value for option is out of range
30027 Trigger sequence value invalid
30028 Where to send trigger text to is invalid
30029 Trigger label not specified/invalid for 'send to variable'
30030 File name specified for plugin not found
30031 There was a parsing or other problem loading the plugin
30032 Plugin is not allowed to set this option
30033 Plugin is not allowed to get this option
30034 Requested plugin is not installed
30035 Only a plugin can do this
30036 Plugin does not support that subroutine (subroutine not in script)
30037 Plugin could not save state (eg. no state directory)
30039 Plugin is currently disabled
30040 Could not call plugin routine
30041 Calls to "Execute" nested too deeply
30042 Unable to create socket for chat connection
30043 Unable to do DNS (domain name) lookup for chat connection
30044 No chat connections open
30045 Requested chat person not connected
30046 General problem with a parameter to a script call
30047 Already listening for incoming chats
30048 Chat session with that ID not found
30049 Already connected to that server/port
30050 Cannot get (text from the) clipboard
30051 Cannot open the specified file
30052 Already transferring a file
30053 Not transferring a file
30054 There is not a command of that name
30055 That array already exists
30056 That array does not exist
30057 Values to be imported into array are not in pairs
30058 Import succeeded, however some values were overwritten
30059 Import/export delimiter must be a single character, other than backslash
30060 Array element set, existing value overwritten
0 No error
30062 Cannot import because cannot find unused temporary character
30061 Array key does not exist



- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


5,983 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

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