Re: To if someone's entering a room

From: Skylar (
Date: 05/08/96

> Is it possible for a mob in a SPECIAL() to detect if someone
> arrived in the room? Which function can tell that.

No.  Not in a special.  You might want to look into putting a check into
char_to_room() (in handler.c) if its that important for you to know as
someone enters a room.  You'd be better off using a check there, than in 
the movement functions, because you'll be covering a lot more (most) ways
that people might enter the room (ie teleport, summon, etc).

> How can a mob detect that someone is giving him something.
> I want to make a SPECIAL() so that, if you give a mob a
> certain object, you receive some amount of money.

#define YOUR_OBJ  xxxx <--- that should be the vnum of the obj

  char arg1[MAX_INPUT_LENGTH];
  char arg2[MAX_INPUT_LENGTH];
  struct char_data *mob = me;
  struct char_data *obj;

  if (CMD_IS("give")) {

   /* check for args, if none, pass it back to do_give   */
    two_arguments(argument, arg1, arg2);
    if (!*arg || !*arg2)  
      return 0; 

   /* make sure its meant to be given to this mob...     */
    if (get_char_room_vis(ch, arg2) != mob)
      return 0;

   /* if its the right obj, pass it off and do something */
    if ((obj = get_obj_in_list_vis(ch, arg1, ch->carrying)) &&
         GET_OBJ_VNUM(obj) == YOUR_OBJ) {
      obj_to_char(obj_from_char(obj), mob);
      act("$n says, 'Gee, thanks, I always wanted a $p.", 
                                  0, mob, obj, 0, TO_ROOM);

   /* put reward of gold and thanking or whatever here   */

      return 1;
  return 0;

Hm, that looks a lil messy, I'm used to a wider screen than this 
mailer lets me use... it should work though.



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