SYNOPSIS
mapping P_DETAILS "Details"
mapping Set(P_DETAILS, mapping value)
mapping Query(P_DETAILS)
or
mapping SetDetails(mapping value)
mapping QueryDetails()
Accessible via:
void AddDetail(string|string * id, string desc)
void AddDetail(string|string * id, string desc, string exadesc)
void AddDetail(string|string * id, string * desc)
void AddDetail(string|string * id, closure desc)
void RemoveDetail(string|string * id)
string|string* GetDetail(string id)
DESCRIPTION
This property implements the details of a room, i.e. things which
may be closer examined, but need not be represented with an own
object.
The value of the property is a mapping of the detail descriptions,
with the id of each detail indexing its description.
The description may be:
- a single string, which is used for both 'look at' and
'examine',
- an array of two strings, the first for 'look at', the second
for 'examine',
- a closure returning a string or an array of two strings.
The closure will be called with the id of the detail as
argument.
Rooms with doors feature the additional detail 'doors', being a
list of all visible doors, which is not stored in P_DETAILS.
Similar, outdoor rooms feature the automatic details 'sky' and
'heaven', _unless_ they are specified in P_DETAILS.
The details cooperate with /std/room/description::DoExplore() to
implement the explorer facilities.
The details should be accessed via AddDetail(), RemoveDetail() and
GetDetail().
string|string* GetDetail(string id)
Return the description(s) for detail <id>, or 0 if it isn't
defined. This takes care of closure evaluation and automatic
details.
void AddDetail(string|string * id, string desc)
Add/redefine a detail <id> with the description <desc>.
If an array of ids is given, each of the details gets the same
description (this is also valid for the other AddDetail()
forms).
void AddDetail(string|string * id, string desc, string exadesc)
Add/redefine a detail <id> with the 'look'-description <desc>
and the 'examine'-description 'exadesc'.
void AddDetail(string|string * id, string * desc)
Add/redefine a detail <id> with the description <desc>.
<desc> is either the array ({ "look-descr", "examine-descr" })
or of the form ({ "#call_other", <object>, "functionname", ... }).
The latter form will be compiled into a closure and stored as such.
void AddDetail(string|string * id, closure desc)
Add/redefine a detail <id> with the closure <desc> returning the
actual description.
void RemoveDetail(string id)
Remove the detail <id> if existing.
void RemoveDetail(string * ids)
Remove the details <ids> if existing.
EXAMPLE
// Add a detail to look at.
AddDetail("tree", "A marvellous tree.\n");
// Add a detail with two descriptions, using two methods.
AddDetail("bush", "A small bush.\n", "Really, a small bush.\n");
AddDetail("bush", ({ "A small bush.\n", "Really, a small bush.\n" }));
// Add a detail to resolved by a local function 'theoak()'.
AddDetail("oak", #'theoak);
// Remove all the details added above.
RemoveDetail(({"tree", "bush", "oak"}));
AVAILABILITY
Include: <properties.h>
Availability: /std/room/(details), /std/npc and descendants.
SEE ALSO
room(S), explorable(P), items(P), noises(P), indoors(P),
readmsgs(P), smells(P)