Man examine
From LSWiki
Revision as of 16:45, 11 June 2007 (edit) Laine (Talk | contribs) ← Previous diff |
Current revision (16:45, 11 June 2007) (edit) Laine (Talk | contribs) |
Current revision
Description
The command 'examine' and 'look at' are used to get description of specific things. These can be objects in the command-giver's inventory or environment. (Or, as we'll see, part of the environment object itself).
The syntax for the various forms of the command are
examine <what> look at <what>
Where <what> can be the name of any object in the user's inventory, the environment, or defined by the environment itself. Where there might be confusion, the objects are looked for in the order given, so a person carrying a sword cannot 'look at sword' and see a sword in their environment.
The room code supports described objects. These are not really objects, they do not exist as such, and therefore have no properties _except_ those given by the room. So far, the room supports only the description property. See the documentation on rooms in /doc/rfun for more details, but here is the short version:
set_item_descriptions(string *names, string *descr);
The first argument is an array of strings (id:s of objects). The second is a corresponding array of descriptions. This line could appear in the create() function of a room, in which case these objects would then be examinable in the room.
When the player does 'examine xxx', then first present(xxx,this_player()) is called, then present(xxx,environment(this_player())), then finally, environment()->id(xxx). If any of these returns non-nil, then a description is available for the object. In the case of real objects, query_long() will be called in them. In the case of describable objects, the room will print the description if environment()->query_long(xxx) is called.
Note: the command 'look' (without arguments) is the command to examine the long description of the current room.