|
CHAPTER 1
Room Items:
Now, our room is still rather boring, we have description, weather and
exits, but it is lifeless. Normally the description is more elaborate than
ours, but the player can't look close at the things described there.
Now, add something like: "You see an apple tree nearby." to your long
description and insert the these lines after the set_exits() function:
set_items( ({
"tree#apple tree", "The tree is full of green apples"
}) );
We have again an array, the first, third, fifth (odd) elements are a list
of so called IDs. These are identificators that are recognized by the
game, and are separated by '#' and have to be all fully lower case. The
second, fourth (even) elements are the descriptions. These virtual objects
are the so called room items or shortly items. It is has to be capitalized
(beginning in uppercase) and it must not end with newlines '\n' as it
added automatically. A '.' is added automatically, if the last character
is no '!', '?' or ' '('<space>').
Now reload the room, type 'look at tree', add a second item "apple" as the
third element and a description for it as the forth element of the array.
Then reload it again and look at your work.
Extension:
Since August 2016 set_item() supports also arrays for the IDs:
set_items( ({
({ "tree", "apple tree" }), "The tree is full of green apples"
}) );
This is the way items are stored within the room. The notation with '#'
is converted by the room code into arrays. The notation with arrays is
often more confusing but there might be situations when it is useful to
do it this way.
Also set_day_items() and set_night_items() (see page 10 or
https://nemesis.de/lpc/doc/room2/page10 ) support this.
Changed/modified/modernised in August 2016!
See also: |
|