-
-
Notifications
You must be signed in to change notification settings - Fork 685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cmd default msg share #1204
Cmd default msg share #1204
Conversation
evennia/settings_default.py
Outdated
@@ -347,6 +347,11 @@ | |||
# default class logs channel messages to a file and allows for /history. | |||
# This setting allows to override the command class used with your own. | |||
CHANNEL_COMMAND_CLASS = "evennia.comms.channelhandler.ChannelCommand" | |||
# These specify defaults to the base Command parent class |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these require individual comments. Stuff like MSG_SHARE
is not intuitive!
Would it be a better practice to ... use The confusion I have with the use of |
You don't know from the base Command class what caller is, necessarily, it's just duck typing through the shared |
@BlauFeuer The reason for @TehomCD I presume you are making this session suggestion since Arx does not use the full power of |
@Griatch I switched Arx to using |
I guess I can see it being confusing in |
Merged with a rebase and some further tweaks to the names and docstrings (see 80f7bb1). |
@TehomCD said "For a while, I had been using 'self.msg' in all my commands as a shortcut to sending messages to the command's caller." @Griatch said "The main purpose for using self.msg is specifically to not have to send to all Sessions connected to the Player." Most of the time, the session that initiated the command is the only session that should see the output, and based on what you've both said, this is the default behavior. Then I asked: The reason I asked is, when output should go to all sessions connected to a character or all sessions going to a player, using self.msg or caller.msg isn't the way to do it, correct? My question still seems unanswered to me, probably because I was confused before this PR. Additionally, I'm confused because I don't understand how changing the default behavior of self.msg/caller.msg globally makes sense over just choosing to send to all player or all character sessions in the context of the command instead of sending only to a single session on the calling object. I just haven't found a clear statement documenting the these three situations, which for clarity are listed below with my guess. Please help me and explain if I'm right, wrong, or somewhere in between:
|
The reason for the differences is that the unique Session is not available to all objects at all times.
The Command's |
So all of the confusion stems from the fact that What's a better way, or a best practice then? Obviously if it tripped up Tehom, then the expected behavior isn't always the actual behavior. |
(Edit: I removed the previous post, I remembered it wrong). Basically, if you know at which level you store your Command (Session, Player or Object) then you also know what |
Agreed, "whether self.msg will be shared across sessions" is only part of what this PR is for, but … that particular behavior varies per use unless, now thanks to a section of this PR, it is set globally. I don't always know at what object level the Command is stored, which is why I am asking what is the best practice when coding. It's more obvious to me where the message is going when the object variable isn't I'm assuming that the same command can be stored at different levels on different objects, because a single command can be included in multiple command sets, or the same command set can be stored on different objects. It takes awhile for an initiate to understand the subtleties. |
The |
Brief overview of PR changes/additions
For a while, I had been using 'self.msg' in all my commands as a shortcut to sending messages to the command's caller. After enabling multisession mode, players were confused about not receiving echoes to their other sessions from commands. I decided to put in a way to change the base behavior of the Command class by making it look in the settings file, while keeping existing behavior the same for anyone who doesn't change the defaults.
Motivation for adding to Evennia
Make Command defaults more customizable. The options I included are changing the default arg_regex, the default help_category, whether
self.msg
will be shared across sessions, and default locks.Other info (issues closed, discussion etc)
N/A