A
/ \ _ Play Now Nemesis on
| | | | _______ _ _ _______ _______ _ _______
| |\ | | | ____| | \ / | | ____| / ____| | | / ____|
/-------/-------------------------------------------------------------------,
O= Home <=XX| About News Pics Adventurers Wizards Download Connect >
\-------\-------------------------------------------------------------------'
| | \ | | |____ | | | | | |____ ___ \ \ | | ___ \ \
| | \_| |_______| |_| |_| |_______| |_______/ |_| |_______/
\ /
V
Documentation Area
Document Path: /doc/object/get
Lfun: get - this object is being taken
Synopsis:
int get(string item)
Description:
The get function is called by the player object each time the player
wants to do a transaction with an item, like get, drop, put or sell.
The item argument is the id-string a player used to reference the
object.
Return value:
If you want an item not to be taken return 0, else return 1.
If the object self-destructs in the drop function, be sure to return 1
immediately after the destruct() call, as the destructed item surely
can't be dropped. Similarly, if drop is called in another object,
always test if the object did self-destruct (the object pointer will
turn to 0 then).
Examples:
If you want that object to be taken or dropped only when using the
correct id-string, then things are bit more complicated.
Let's consider Walter's example:
Your object is a jar containing a frog on a ladder.
You want to be able to return descriptions for 'x frog' and 'x ladder',
therefore you define those id-strings in id() and provide descs in
long(). To avoid 'get frog' to act like 'get jar' you just have to do
this:
get(id) { return id != "frog" && id != "ladder"; }
See also:
This page was generated in LPC
Imprint / Impressum