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

Feature Request: Make scripts valid message senders #1179

Closed
SquirrelFu opened this Issue Jan 28, 2017 · 4 comments

Comments

Projects
3 participants
@SquirrelFu

SquirrelFu commented Jan 28, 2017

Brief summary of issue:

For those of us familiar with MUSH systems as staffers, we likely know about job systems. In my efforts to create one for my own MUSH, I ran into a snag. Specifically, that I could not set the job handler script as a message's sender as it only supports objects, players, and external sources as senders.

Steps to reproduce the issue:

  1. Create a new message manually with create from evennia.utils
  2. Pass a script object as the sender
  3. Watch the system bork itself up (Optional)

Error output

In concrete terms, any attempts to send a message with a script as a sender results in a None-type object being saved to the field. This can cause significant issues when attempting to display or retrieve the message later. Hence, any attempts to do so tend to throw an AttributeError.

Extra information:

Well, the basic idea I have is adding the script DB as a valid list of objects (In the object-oriented coding sense) to compare the incoming script against. I'm not sure if there is a reason here, but it seems to be problematic what I was attempting to do.

@TehomCD

This comment has been minimized.

Show comment
Hide comment
@TehomCD

TehomCD Jan 28, 2017

Contributor

You can attach tags to Msg objects with arbitrary data, so for custom models I have that I wanted to associate with Msg objects, I just made tags of a category that identified the model and then made a tag that corresponded to some combination of the model/id to identify it uniquely. You could do the same by having tags like msg.tags.add("script_15_sender", category="script sender")

Alternately, you can use the db_senders_external field in a Msg object to attach a string name of the sender, and just pass along the script name if you want to make it appear from them, but don't necessarily need to access its data. Or use it similarly to tags for getting the script objects from its key when you pass it along.

Contributor

TehomCD commented Jan 28, 2017

You can attach tags to Msg objects with arbitrary data, so for custom models I have that I wanted to associate with Msg objects, I just made tags of a category that identified the model and then made a tag that corresponded to some combination of the model/id to identify it uniquely. You could do the same by having tags like msg.tags.add("script_15_sender", category="script sender")

Alternately, you can use the db_senders_external field in a Msg object to attach a string name of the sender, and just pass along the script name if you want to make it appear from them, but don't necessarily need to access its data. Or use it similarly to tags for getting the script objects from its key when you pass it along.

@Griatch Griatch changed the title from Scripts are invalid message senders. to Feature Request: Make scripts valid message senders Jan 29, 2017

@Griatch

This comment has been minimized.

Show comment
Hide comment
@Griatch

Griatch Jan 29, 2017

Member

This is not a bug but a well-documented feature of Msg:es. They originally only supported Players, but was extended to also support ObjecDBs by popular demand. We could by all means extend it to Scripts too, there was just never a reason to.

Changed to a feature request.

Member

Griatch commented Jan 29, 2017

This is not a bug but a well-documented feature of Msg:es. They originally only supported Players, but was extended to also support ObjecDBs by popular demand. We could by all means extend it to Scripts too, there was just never a reason to.

Changed to a feature request.

@Griatch Griatch added this to TODO in Evennia 0.7 Feb 10, 2017

@Griatch

This comment has been minimized.

Show comment
Hide comment
@Griatch

Griatch Feb 10, 2017

Member

Moved to devel for Evennia 0.7.

Member

Griatch commented Feb 10, 2017

Moved to devel for Evennia 0.7.

Griatch added a commit that referenced this issue Feb 17, 2017

@Griatch Griatch added the implemented label Feb 17, 2017

@Griatch Griatch moved this from TODO to Done on devel branch in Evennia 0.7 Feb 19, 2017

@Griatch

This comment has been minimized.

Show comment
Hide comment
@Griatch

Griatch Sep 20, 2017

Member

Closed with the merger of devel branch.

Member

Griatch commented Sep 20, 2017

Closed with the merger of devel branch.

@Griatch Griatch closed this Sep 20, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment