Addendum: This paragraph about dynamic items via the "@@func@@" feature
was added in August 2016.
There are two further possibilies for dynamic items.
First: NONE of these possibilies needs a special '#define DYNAMIC_ITEMS'.
It is NOT part of EXTD_ROOM as stated here before! NO NEED neither to
'#define EXTD_ROOM' nor to '#define DYNAMIC_ITEMS' at all for dynamic
items!!! Both are standard features of normal standard room2.h!
Instead of the description of an item you put there an expression like
"@@<function_name>@@". The leading AND trailing '@@' tell the room code
to call the function "<function_name>" in the room instead of displaying
it. Imagine you have a window players can open and close. Via add_action
(see page 15 or https://nemesis.de/lpc/doc/room2/page15 ) you have made
an 'open' and a 'close' that changes the value of 'window_open'. With
these lines below player get the correct description for the window:
if (window_open) return write("The window is open.\n");
write("The window is closed.\n");
This method also works with set_day_items and set_night_items.
To control the availability of such a dynamic item, an own simple id
function is needed:
if (!apple_here) return 0;
An id function like the above is also needed for the option for dynamic
items described on the previous page, if the item should "disappear".
AND don't forget to set values like 'window_open' or 'apple_here' in
reset back to a good and valid start.
Since June 2016 the "@@func@@" feature supports process_string - see
'man efun/process_string'. Now you can call functions in other objects
and even give arguments! Wastl added this feature (see 'whois wastl' or
Now the last method to add/change/remove descriptions of room items.
To be honest, I (Kiri) don't like this method. First, it sounds cool,
but later you recognise, that the "@@func@@" method is much cooler :-)
Via the set of function mentioned below items can be added, modified
As you know there are 3 types of items: "normal" items, day items and
night items. To avoid lots of functions, the last argument states, to
which type of items the function applies.
The necessary defines are included automatically via '#include <room2.h>
and are named ITEMS, DAY_ITEMS and NIGHT_ITEMS. Following functions are
add_item(id, desc, type) adds an item.
change_item(id, desc, type) changes the description of an item.
remove_item(id, type) removes an item.
Note, that 'id' in remove_item and change_item only has to be one of
(eventual) several IDs.
Please make also sure to reset your item descriptions at every reset.
Here starts a problem about add_item etc., why I (Kiri) prefer the
method with "@@func@@" :-( You have to keep the status of a dynamic
item in separate variable, e.g. 'window_open' etc., e.g. if a possible
action depends on the status: e.g. 'climb window' only works if it
open. Every time the status of the window changes, you have to change
the status in 'window_open' and in the description of the item. Also
in reset, especially in recurring resets. Keeping one status in two
places syncronized, where one place could not so easy be checked,
is annoying ... It sounds easy, but ...
Further questions? Contact me ;-) Cause of this I will not write any
real manual about add_item, remove_item and change_item! ;-) There ARE
much better methods to code dynamic items! :-D See upper part on this
Changed/modified/modernised by Kiri in August 2016.