# evennia.commands.default.syscommands¶

System commands

These are the default commands called by the system commandhandler when various exceptions occur. If one of these commands are not implemented and part of the current cmdset, the engine falls back to a default solution instead.

Some system commands are shown in this module as a REFERENCE only (they are not all added to Evennia’s default cmdset since they don’t currently do anything differently from the default backup systems hard-wired in the engine).

Overloading these commands in a cmdset can be used to create interesting effects. An example is using the NoMatch system command to implement a line-editor where you don’t have to start each line with a command (if there is no match to a known command, the line is just added to the editor buffer).

class evennia.commands.default.syscommands.SystemNoInput(**kwargs)[source]

This is called when there is no input given

key = '__noinput_command'
locks = 'cmd:all()'
func()[source]

Do nothing.

aliases = []
help_category = 'general'
lock_storage = 'cmd:all()'
class evennia.commands.default.syscommands.SystemNoMatch(**kwargs)[source]

No command was found matching the given input.

key = '__nomatch_command'
locks = 'cmd:all()'
func()[source]

This is given the failed raw string as input.

aliases = []
help_category = 'general'
lock_storage = 'cmd:all()'
class evennia.commands.default.syscommands.SystemMultimatch(**kwargs)[source]

Multiple command matches.

The cmdhandler adds a special attribute ‘matches’ to this system command.

matches = [(cmdname, args, cmdobj, cmdlen, mratio, raw_cmdname) , (cmdname, …), …]

Here, cmdname is the command’s name and args the rest of the incoming string, without said command name. cmdobj is the Command instance, the cmdlen is the same as len(cmdname) and mratio is a measure of how big a part of the full input string the cmdname takes up - an exact match would be 1.0. Finally, the raw_cmdname is the cmdname unmodified by eventual prefix-stripping.

key = '__multimatch_command'
locks = 'cmd:all()'
func()[source]

Handle multiple-matches by using the at_search_result default handler.

aliases = []
help_category = 'general'
lock_storage = 'cmd:all()'
class evennia.commands.default.syscommands.SystemSendToChannel(**kwargs)[source]

This is a special command that the cmdhandler calls when it detects that the command given matches an existing Channel object key (or alias).

key = '__send_to_channel_command'
locks = 'cmd:all()'
parse()[source]

This method is called by the cmdhandler once the command name has been identified. It creates a new set of member variables that can be later accessed from self.func() (see below)

The following variables are available for our use when entering this method (from the command definition, and assigned on the fly by the cmdhandler):

self.key - the name of this command (‘look’) self.aliases - the aliases of this cmd (‘l’) self.permissions - permission string for this command self.help_category - overall category of command

self.caller - the object calling this command self.cmdstring - the actual command name used to call this

(this allows you to know which alias was used,

for example)

self.args - the raw input; everything following self.cmdstring. self.cmdset - the cmdset from which this command was picked. Not

often used (useful for commands like ‘help’ or to list all available commands etc)

self.obj - the object on which this command was defined. It is often

the same as self.caller.

A MUX command has the following possible syntax:

name[ with several words][/switch[/switch..]] arg1[,arg2,…] [[=|,] arg[,..]]

The ‘name[ with several words]’ part is already dealt with by the cmdhandler at this point, and stored in self.cmdname (we don’t use it here). The rest of the command is stored in self.args, which can start with the switch indicator /.

Optional variables to aid in parsing, if set:
self.switch_options - (tuple of valid /switches expected by this

command (without the /))

self.rhs_split - Alternate string delimiter or tuple of strings

to separate left/right hand sides. tuple form gives priority split to first string delimiter.

This parser breaks self.args into its constituents and stores them in the following variables:

self.switches = [list of /switches (without the /)] self.raw = This is the raw argument input, including switches self.args = This is re-defined to be everything except the switches self.lhs = Everything to the left of = (lhs:’left-hand side’). If

no = is found, this is identical to self.args.

self.rhs: Everything to the right of = (rhs:’right-hand side’).

If no ‘=’ is found, this is None.

self.lhslist - [self.lhs split into a list by comma] self.rhslist - [list of self.rhs split into a list by comma] self.arglist = [list of space-separated args (stripped, including ‘=’ if it exists)]

All args and list members are stripped of excess whitespace around the strings, but case is preserved.

func()[source]

Create a new message and send it to channel, using the already formatted input.

aliases = []
help_category = 'general'
lock_storage = 'cmd:all()'