**Language / Langue :** [[fr:txt:objets|FR]] | **EN**
====== Objects and states (.txt format) ======
===== Collectable objects =====
Objects are declared on **line 3** of a room (the objects/variables line). Each object has 5 fields separated with ''|'':
object_name|place|place_description|pickup_text|object_description
* ''object_name'' - identifier (no space)
* ''place'' - furniture or spot where the object lies (used by the ''inspect place'' command)
* ''place_description'' - text shown when the player inspects the place
* ''pickup_text'' - text shown when the object is taken (''take object'' command)
* ''object_description'' - text shown when the player inspects the object (''inspect object'' command)
Example:
lamp|table|A table with four legs. There is a lamp on it!|You pick up the lamp.|The lamp lets you light your way.
For several objects in the same room, separate them with ''|'' or use ''&&'' to spread them over several lines.
===== Invisible objects and states =====
Invisible objects do **not** appear in the visible inventory: they act as states, conditions, classes, and so on. The keyword is ''invisible'' instead of the place:
state_name|invisible|unused_note|acquisition_text|state_description
They are **acquired automatically** when the player enters the room, with no need for the ''take'' command.
To check that a player holds a state as a room condition:
2|tired_state|You are far too tired!|You enter the room.
To check that they do **not** hold it (negative condition):
2|-tired_state|You are not tired any more.|Good, you may enter.
===== Removing an object automatically =====
Put a ''-'' before the object name on the objects/variables line. If the object is in the inventory, visible or invisible, it is removed:
-lamp|invisible|note|The lamp breaks as it falls.|The lamp.
===== Several copies of an object =====
Repeat the object several times in the same room. The player can take it as many times as there are copies:
lamp|table|There are two lamps on the table!|You take a lamp.|The lamp.
lamp|table|One lamp is left on the table.|You take the last lamp.|The lamp.
empty|table|The table is empty now.|How did you find that?|Nothing here.
The third object, ''empty'', exists to display a description once the table has been emptied.