How do I remove default Character commands - but also keep Admin commands #3424
-
Hey all, I want to get rid of a lot of the default character commands and start from scratch. Things like 'look', 'get', 'say', etc. My first solution involved commenting out the default commands, but I'm not sure changing the evennia package is wise. Then I tried adding Would creating a new Character class from Object (instead of What is the best practice for overriding certain default commands? Any help is appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
You never change the evennia core package. As outlined in the beginner tutorials, you make your changes in # in mygame/commands/default_cmdsets.py
# if you have your own replacements in mygame/commands/mycommands.py
from commands import mycommands
class CharacterCmdSet(default_cmds.CharacterCmdSet):
"""
The `CharacterCmdSet` contains general in-game commands like `look`,
`get`, etc available on in-game Character objects. It is merged with
the `AccountCmdSet` when an Account puppets a Character.
"""
key = "DefaultCharacter"
def at_cmdset_creation(self):
"""
Populates the cmdset
"""
super().at_cmdset_creation()
#
# any commands you add below will overload the default ones.
#
self.add(mycommands.CmdLook) # Replace default `look` with one of your own (must have same key)
self.remove(default_cmds.CmdGet) # Revove default `get` completely That is, you use |
Beta Was this translation helpful? Give feedback.
-
I've tried removing or adding my own commands, but every time I get errors like this: `Traceback (most recent call last): Compile/Run error when loading cmdset 'commands.default_cmdsets.CharacterCmdSet'. Error encountered for cmdset at path 'commands.default_cmdsets.CharacterCmdSet'. I have a mycommands.py file containing:_COMMAND_DEFAULT_CLASS = utils.class_from_module(settings.COMMAND_DEFAULT_CLASS) class CmdHome(COMMAND_DEFAULT_CLASS):
### and in the default_cmdset.py file I added from commands import mycommands I would be grateful for a working instruction on how to add your own or remove existing commands. Or at least someone show their example mycommands.py and default_cmdsets.py files |
Beta Was this translation helpful? Give feedback.
-
Thanks. I have read the documentation and now I know where I made mistakes. Now everything works. |
Beta Was this translation helpful? Give feedback.
You never change the evennia core package.
As outlined in the beginner tutorials, you make your changes in
mygame/commands/default_cmdsets.py
: