`@spawn` traceback within evennia.prototypes.prototypes.protfunc_parser
See original GitHub issueBrief summary of issue / Description of requested feature:
Based on https://github.com/evennia/evennia/wiki/evennia.prototypes.protfuncs, it seems like all protofunc
s are preceeded by $
character. However, prototype values without preceding $
are getting treated as $protofunc
.
Steps to reproduce the issue / Reasons for adding feature:
@spawn {'key':'stone(#1234)'}
Error output / Expected result of feature
18-10-24 01:46:49 [::] Traceback (most recent call last):
18-10-24 01:46:49 [::] File "/usr/src/evennia/evennia/commands/cmdhandler.py", line 594, in _run_command
18-10-24 01:46:49 [::] _progressive_cmd_run(cmd, ret)
18-10-24 01:46:49 [::] File "/usr/src/evennia/evennia/commands/cmdhandler.py", line 193, in _progressive_cmd_run
18-10-24 01:46:49 [::] value = generator.next()
18-10-24 01:46:49 [::] File "/usr/src/evennia/evennia/commands/default/building.py", line 3098, in func
18-10-24 01:46:49 [::] for obj in spawner.spawn(prototype):
18-10-24 01:46:49 [::] File "/usr/src/evennia/evennia/prototypes/spawner.py", line 694, in spawn
18-10-24 01:46:49 [::] create_kwargs["db_key"] = init_spawn_value(val, str)
18-10-24 01:46:49 [::] File "/usr/src/evennia/evennia/prototypes/prototypes.py", line 735, in init_spawn_value
18-10-24 01:46:49 [::] value = protfunc_parser(value)
18-10-24 01:46:49 [::] File "/usr/src/evennia/evennia/prototypes/prototypes.py", line 583, in protfunc_parser
18-10-24 01:46:49 [::] stacktrace=stacktrace, testing=testing, **kwargs)
18-10-24 01:46:49 [::] File "/usr/src/evennia/evennia/utils/inlinefuncs.py", line 425, in parse_inlinefunc
18-10-24 01:46:49 [::] retval = "".join(_run_stack(item) for item in stack)
18-10-24 01:46:49 [::] File "/usr/src/evennia/evennia/utils/inlinefuncs.py", line 425, in <genexpr>
18-10-24 01:46:49 [::] retval = "".join(_run_stack(item) for item in stack)
18-10-24 01:46:49 [::] File "/usr/src/evennia/evennia/utils/inlinefuncs.py", line 423, in _run_stack
18-10-24 01:46:49 [::] retval = "" if strip else func(*args, **kwargs)
18-10-24 01:46:49 [::] File "/usr/src/evennia/evennia/prototypes/protfuncs.py", line 315, in obj
18-10-24 01:46:49 [::] obj = _obj_search(return_list=False, *args, **kwargs)
18-10-24 01:46:49 [::] File "/usr/src/evennia/evennia/prototypes/protfuncs.py", line 295, in _obj_search
18-10-24 01:46:49 [::] raise ValueError("$obj: Query '{}' gave no matches.".format(query))
18-10-24 01:46:49 [::] ValueError: $obj: Query '#1234' gave no matches.
18-10-24 01:46:49 [EE] User input was: '@spawn {'key':'stone(#1234)'}'.
Extra information, such as Evennia revision/repo/branch, operating system and ideas for how to solve / implement:
It seems like the parsing and its regular expression is incorrect?
Code lifted from evennia.prototypes.prototypes.protfunc_parser
import re
_RE_DBREF = re.compile(r"(?<!\$obj\()(#[0-9]+)")
v = 'stone(#1234)'
_RE_DBREF.sub('$obj(\\1)', v)
'stone($obj(#1234))'
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (14 by maintainers)
Top Results From Across the Web
Spawner and Prototypes — Evennia 1.0-dev documentation
The spawner is a system for defining and creating individual objects from a base template called a prototype. It is only designed for...
Read more >evennia.prototypes.prototypes · evennia/evennia Wiki
Helper function to check access to actions on given prototype. Args: prototype_key (str): The prototype to affect. action (str): One of "spawn" ...
Read more >Python Multiprocessing Traceback (most recent call last)
_name) File "C:\Users\Goal\AppData\Local\Programs\Python\Python39\lib\multiprocessing\spawn.py", line 154, in get_preparation_data File ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The
$obj
protfunc is more general since it allows you to free-form search for an object by key, alias or dbref. Having a separate$dbref()
only for dbrefs could be pretty intuitive though, I agree.The wiki is normally edited in-place, in the web interface. Usually no permission is needed. If you have some big change and are unsure about it you can always ask about it in IRC/Discord.
Sounds good 😃