CAN_PUT_AND_GET(L)

NAME
	can_put_and_get - determine if an object is a container

SYNOPSIS
	int can_put_and_get(string str)

RETURN VALUE
	When a player examines an object, the name of the object the player
	is looking at is passed to can_put_and_get().  If a true value
	is given, the inventory of the object is printed for the player.
	A false value means the object is 'opaque'.  If no string is
	passed, it normally means the player is trying to put something into
	or take something from the object.  A true value means this operation
	is allowed.  A false value forbids it.

DESCRIPTION
	This function defines whether an object is a container or not, within
	the mudlib.  In a sense, all objects can be containers, but a this
	function enables them to act like containers to players, in the sense
	that it allows players to see what objects are contained by another
	object, and whether players are allowed to take objects from as well
	as insert objects into the container object.

NOTES
	It is not enough to define this true if you want a player to be
	able to insert things in an object or give them to a monster.
	The local function add_weight() must also return a true value.

	Containers such as bags will return 1 in all cases.  

	Containers like chests will return 1 when the chest is open, 0 when 
	it is closed.  

	Living objects will return 1 when strings are passed to
	them, 0 when nothing is passed to can_put_and_get() (you can thus
	see what a monster is carrying, but you can't take anything away).

	Sometimes an item will have 'parts' attached to it that are different
	from the object itself in a logical sense.  For instance, a chest and
	the lid of the chest.  When the player looks at the lid, you don't
	want to print out the inventory of the chest, so you return 0 when
	anything other than 'chest' is passed to can_put_and_get.

	This function is automatically defined in living.c, so the strange
	behavior of why arguments are passed can be ignored most of the time.

	The id() of the function is checked before can_put_and_get() is
	called.

	The descriptions of the inventory are handled in and printed by
	the player object.

EXAMPLES
	In a chest:
	int can_put_and_get(string str) {
	   if( str == "lid" ) /* This conditional is of course optional */
	      return 0; /* And presumably long() prints out special desc. */
	   return chest_is_open;
	}

SEE ALSO
	add_weight(L), long(L) 

Help topics available:
add_hook add_weight can_put_and_get clean_up drop
extra_look get heart_beat id init
init_arg is_armour is_money is_weapon long
query_auto_load query_hook query_long query_name query_prevent_move_from_statue
remove_hook reset set_long set_name set_short
short

[START|BACK ]




[ NannyMuds main page | FAQ | Contact us ]

You are guest number 83 since January 2020.
This file was last modified: June 2000.