Message
mud.message is a wrapper for the C message function of the same name. It takes
roughly the same variables, and uses macro expansions for quick inclusion on
character, target, and object information. It takes the form:
message(ch, vict, obj, vobj, show_invis, range, mssg)A reference manual for message() can be found in the reference section.
Newstyle Messages
As of version 3.8, NakedMud implements newstyle messages that extend
char.Char.send . As of version 3.9, NakedMud also implements newstyle messages
to multiple people with char.Char.sendaround and mud.send . These work by
allowing users to embed Python statements within sent messages, in the same way
that they can be embedded in game contents' descriptions.
ch.send(mssg, dict=None, newline=True)
Characters have a method, send, that outputs a string of text to their socket.
If a dictionary is provided, text between [ and ] are expanded out as Python
statements. When statements are expanded, the variable 'me' references the
character being sent the message.
> exec ch.send("Hello, [me.name]!") Hello, [me.name]! > exec ch.send("Hello, [me.name]!", dict={}) Hello, Alister! > exec ch.send("Hello, [me.name]. You are in [me.room.name]. foo=[foo].", dict={ "foo" : "bar" }) Hello, Alister. You are in Some Room Name Here. foo=bar. > exec ch.send("You are wearing [if head==None]nothing[else][head.name][/if] on your head.", dict = { "head" : ch.get_equip("head") }) You are wearing a red fez on your head.
ch.sendaround(mssg, dict=None, cansee_only=False, newline=True)
The sendaround method works similar to send, except it sends the message to
everyone in the character's room, besides the person sendaround is called for.
When Python statements are expanded, the variable 'me' references the person
sendaround is called for. The variable 'ch' references characters messages are
being sent to.
> exec ch.sendaround("Hello, [ch.name]. [me.name] is sending you a message!", dict={}) (Seen by OtherPerson1) Hello, OtherPerson1. Alister is sending you a message! (Seen by OtherPerson2) Hello, OtherPerson2. Alister is sending you a message!
mud.send(list, mssg, dict=None, newline=True)
This function works much the same as ch.send, except it sends a message to
each person in a list of characters. The variable 'ch' references the character
being sent a message.