diff --git a/evennia/utils/evmenu.py b/evennia/utils/evmenu.py index c9f31b4688..2cb282a641 100644 --- a/evennia/utils/evmenu.py +++ b/evennia/utils/evmenu.py @@ -1185,32 +1185,34 @@ def list_node(option_generator, select=None, examine=None, edit=None, add=None, which processors are available. """ - + mode, selection, new_value = None, None, None available_choices = kwargs.get("available_choices", []) - match = re.search(r"(^[a-zA-Z]*)\s*(.*?)$", raw_string) - cmd, args = match.groups() - mode, selection = None, None - cmd = cmd.lower().strip() - if args: + cmd, args = re.search(r"(^[a-zA-Z]*)\s*(.*?)$", raw_string).groups() + + cmd = cmd.lower().strip() + if cmd.startswith('a') and add: + mode = "add" + new_value = args + else: + selection, new_value = re.search(r"(^[0-9]*)\s*(.*?)$", args).groups() try: - number = int(args) - 1 + selection = int(selection) - 1 except ValueError: - if cmd.startswith("a") and add: - mode = "add" - selection = args + caller.msg("|rInvalid input|n") else: + # edits are on the form 'edit if cmd.startswith("e") and edit: mode = "edit" elif examine: mode = "look" try: - selection = available_choices[number] + selection = available_choices[selection] except IndexError: - caller.msg("|rInvalid index") + caller.msg("|rInvalid index|n") mode = None - return mode, selection + return mode, selection, new_value def _relay_to_edit_or_add(caller, raw_string, **kwargs): pass @@ -1239,8 +1241,8 @@ def list_node(option_generator, select=None, examine=None, edit=None, add=None, if mode == "arbitrary": # freeform input, we must parse it for the allowed commands (look/edit) - mode, selection = _input_parser(caller, raw_string, - **{"available_choices": page}) + mode, selection, new_value = _input_parser(caller, raw_string, + **{"available_choices": page}) if examine and mode == "look": # look mode - we are examining a given entry diff --git a/evennia/utils/spawner.py b/evennia/utils/spawner.py index 2fbdbaed21..c4f732ebbb 100644 --- a/evennia/utils/spawner.py +++ b/evennia/utils/spawner.py @@ -1219,7 +1219,6 @@ def node_meta_desc(caller): return text, options - def node_meta_tags(caller): metaprot = _get_menu_metaprot(caller) text = ["|wMeta-Tags|n can be used to classify and find prototypes. Tags are case-insensitive. "