A
/ \ _ Play Now Nemesis on
| | | | _______ _ _ _______ _______ _ _______
| |\ | | | ____| | \ / | | ____| / ____| | | / ____|
/-------/-------------------------------------------------------------------,
O= Home <=XX| About News Pics Adventurers Wizards Download Connect >
\-------\-------------------------------------------------------------------'
| | \ | | |____ | | | | | |____ ___ \ \ | | ___ \ \
| | \_| |_______| |_| |_| |_______| |_______/ |_| |_______/
\ /
V
Documentation Area
Document Path: /doc/room/produce
Lfun: produce - produce an item on action get
Synopsis:
object produce(string item)
Description:
This function is called in a room whenever a person attempts to
take something. This is currently called before anything else
(might change).
The purpose is to enable a room to create an item 'on request'
by the user (player), usually while also providing description
of the 'virtual' item through a room item description.
Produce should check if the string <item> is an id of the item
to be produced, then clone it and place it in the room (also
via PRODUCE macro - see 'man lib/PRODUCE') eventually checking
if there isn't one available yet (PROVIDE macro). Finally it
should return a pointer to the object, although this is not
being used (yet), or null if the <item> is not being offered.
Notice that you should _NOT_ transfer the item into the user's
inventory. The player takes it via the action 'get'/'take'
coded in obj/player.
Return value:
object or 0
Examples:
Various in Nemesis Village ;-)
Wizards can 'goto ~kiri/workroom', 'x shelves' and 'get <item>'.
// from fictional room
int jacket_taken;
reset(arg) {
if (!present("jacket")) jacket_taken = 0;
[...]
}
produce(str) {
if (str == "jacket" && !jacket_taken && !present("jacket")) {
jacket_taken = 1;
jacket = clone_object("lib/armour/jacket2");
move_object(jacket, this_object());
return jacket;
}
}
Note:
In 1993 Junky said: I don't know of this function, so i can't
guarantee that it works.
In 2015 Kiri says: It works! ;-) Perhaps even before room2.h or
perhaps at least before the original add_extra_object
of room2.h ...
For other possibilities of "searching" see 'man object/search' and
'man room/do_dig'.
See also:
This page was generated in LPC
Imprint / Impressum