Re: Want to have an exit opened when an item is moved

From: Lincoln Chan (linc@CSUA.Berkeley.EDU)
Date: 03/22/95


> I Also need a way to find out if when a _PC_ enters a room if a certain
> item is carried in the inventory of aforesaid PC.

Did you want it to check when a character *walks* into the room, or is
transported there by any means?  There are various ways to do this;
you'd probably want to either put it in char_to_room or do_simple_move.


Easiest thing to do presently is this:
structs.h, add a ROOM_SPECIAL1 to your room extra flags.
constants.c, add the text to your list, so when you stat room, you don't get
   UNDEFINED.
lib/world/wld, flag your room with that flag.
act.movement.c:: do_simple_move, add something like this after ROOM_DEATH 
	check:

if (IS_SET(ROOM_FLAGS(ch->in_room), ROOM_SPECIAL1))
	if ((obj = get_obj_in_list_num(real_object(QQQQ), ch->carrying))) {
		perform_whatever_you_plan_on_doing();
	}

where QQQQ is the virtual number of the object you want to check for.

[HINT: it's set up here that if the object with that virtual number is found,
it's set to be obj, so you can have perform_whatever_you_plan_on_doing()
to be able to that advantage case you want to extract_obj(obj) it or 
something.]

linc



This archive was generated by hypermail 2b30 : 12/07/00 PST