Added the capability of evennia commands to consist of more than one word. So the examples.red_button parent can now be pressed with the command 'push button' instead of 'pushbutton' as before. The variable COMMAND_MAXLEN in the config defines how many words your commands may maximum contain (don't set it higher than needed for efficiency reasons).

The main drawback of multi-word commands are that they can not have any switches; they are intended for in-game use (in states and on objects). Use normal one-word commands for administration and more complex commands with many options.
/Griatch
This commit is contained in:
Griatch 2009-10-18 19:29:18 +00:00
parent 0c29d359f6
commit a711e07b80
4 changed files with 115 additions and 53 deletions

View file

@ -696,10 +696,10 @@ def cmd_setcmdalias(command):
@setcmdalias - define shortcuts for commands
Usage:
@setcmdalias[/switch] [command = ] alias
@setcmdalias[/switch] alias [= command]
Switches:
list - view all command aliases (default)
list - view all command aliases
add - add alias
del - remove and existing alias
@ -713,22 +713,26 @@ def cmd_setcmdalias(command):
args = command.command_argument
switches = command.command_switches
if not args or 'list' in switches:
if "list" in switches:
# show all aliases
string = "Command aliases defined:"
aliases = CommandAlias.objects.all()
if not aliases:
string = "No command aliases defined."
for alias in aliases:
string += "\n %s = %s" % (alias.equiv_command, alias.user_input)
string += "\n %s -> %s" % (alias.user_input, alias.equiv_command)
source_object.emit_to(string)
return
if not args:
source_object.emit_to("Usage: @setcmdalias[/list/add/del] alias [= command]")
return
equiv_command = ""
user_input = ""
# analyze args
if '=' in args:
equiv_command, user_input = [arg.strip() for arg in args.split("=",1)]
user_input, equiv_command = [arg.strip() for arg in args.split("=",1)]
else:
user_input = args.strip()