[Main page] [Overview]   /concepts /messages
SYNOPSIS
messages
DESCRIPTION
The message system allows the construction of semi-intelligent messages
which may adapt themselves to the viewer or other circumstances
(like time, weather etc.)
Messages are supported on the mudlib level even down to low-level
functions like write and therefore can be used not only for messages
and the message() simul efun, but also for e.g. room descriptions.
Especially the M_LIGHT, M_NIGHT, M_DAY and M_SEASON macros are very useful
for room descriptions.
A message is basically an array, containing either text parts
(strings) or a macro/a closure. The complete message basically looks
like ({ string|closure, string|closure, string|closure, ..... })
Following macros are available:
M_NAME( ob) just the name of the object
M_THE_NAME( ob) the name of the object with "the" prepended
M_DESC( ob) the name of the object, with "a" prepended if applicable
M_SHORT( ob) short desc of object, with "a" prepended....
M_THE_SHORT( ob) short desc of object, with "a" prepended
M_VERB( verb, ob) a verb performed by the object
M_PRONOUN( ob) the pronoun (you,he,she..) for an object
M_PRO(ob) -"-
M_POSSESSIVE( ob) the possessive (your, his, her..) for an object
M_POSS(ob) -"-
M_POSSESSIVE_S(ob) the possessive-s form ("Warp's, mrks' ")
M_POSS_S( ob) -"-
M_OBJECTIVE( ob) the objective (you, him, her...) for the object
M_OBJ( ob) -"-
M_OBJECTIVE_SELF( ob) yourself, himself, herself
M_OBJ_SELF( ob) -"-
M_LIST( targets, ob, flag) list objects viewed from ob, usually used for livings
M_OB_LIST( targets, flag) list objects in general form, usually used for inanimate objects
M_CAP( foo) capitalize the included expression
M_SEASON( s, text) only show text if the current season==s
M_DAY( text) only show text if it's currently day
M_NIGHT( text) only show text if it's currently night
There are also shortcuts for commonly used forms:
M_ME
M_ME_VERB( verb)
M_ME_PRO
M_ME_POSS
M_ME_OBJ
M_ME_OBJ_SELF
M_ME_POSS_S
M_ME_CAP
M_ME_THE
M_ME_THE_CAP
Those are the appropriate macros with this_object() as object.
M_PL
M_PL_VERB( verb)
M_PL_PRO
M_PL_POSS
M_PL_POSS_S
M_PL_OBJ
M_PL_OBJ_SELF
M_PL_CAP
The same macros with this_player() as object.
EXAMPLES
Ok, assume Cadellin and Warpi are sitting in a room.
and cadellin would use a message like:
({M_PL, " ", M_PL_VERB( "idle"), " a bit."})
Then Cadellin would see: You idle a bit.
and Warpi: Cadellin idles a bit.
Let's say Foobar would join them and use a message like:
({M_PL, " ", M_PL_VERB( "look"), " at ",
M_OBJ_SELF( this_player()), " and ", M_PL_VERB( "kick"),
M_LIST( present_players()), })
The messages would be:
Foobar: You look at yourself and kick yourself, Cadellin and Warpi.
Cadellin: Foobar looks at itself and kicks itself, you and Warpi.
Warpi: Foobar looks at itself and kicks itself, Cadellin and you.
Pretty simple isn't it.
For how to actually send the array look at the simul_efun
"msgarea" or the function "msg" in STD_PLAYER.
SEE ALSO
simul_efun/msgarea, simul_efun/present_players,
concepts/message_types