eavesdrop snippet (fwd)

From: George (greerga@circlemud.org)
Date: 11/27/98


Fairly important if you use the snippet, and people may find it as a good
idea for thief skills.

(Note that I am not an e-mail gateway but this has merit.)

---------- Forwarded message ----------
Date: Fri, 27 Nov 1998 14:37:26 -0500
From: the count <eglamkowski@angelfire.com>
To: greerga@circlemud.org
Subject: eavesdrop snippet

I put in to subscribe to the mailing list, but haven't gotten added
yet, and I know if I don't tell somebody about this now, I'll forget
later... ;)

So, I went a downloaded the eavesdrop snippet and added it to my mud.
Then I started it up and set some characters eavesdropping and...
nothing!
Upon closer inspection, eavesdrop does its work in send_to_room() which
is used by... purge!  Yes, that's it, only the purge command uses
send_to_room().  It isn't in any macros, so I know that is it.
In order for the command to actually be useful, you need to add the
eavsdropping code that the snippet tells you to put in send_to_room()
in perform_act() as well.

Something like (untested):

  struct char_data *eavesdropper = NULL;

  for (eavesdropper = world[ch->in_room].listening; eavesdropper;
       eavesdropper = eavesdropper->next_listener) {
    if (eavesdropper->desc) {
      /*  the ------'s are used to differentiate eavesdropped stuff from
       *  the stuff that is happening in the same room as the char..
       *  looks like:
       *  -------
       *  john dropped a sword
       *  ------
       */
      sprintf(buf2, "----------\r\n%s----------\r\n", lbuf);
      SEND_TO_Q(CAP(buf2), eavesdropper->desc);
    }
  }


Well, I just wanted to point that out, since it is otherwise a very
interesting idea for a thief skill.
I also think it should have some penalty to use, such as a small
movement cost, but I digress... ;)

I also added in the two scan commands from the ftp site, one as a
general scan command for anybody (the one that goes out three rooms)
and one as a thief skill (the one that goes out up to seven rooms,
depending on level) called scout.

In case you are looking for interesting ways to beef up the thief
class, I find these skills work well.

Also the listen snippet, since that is very different from the
eavesdrop as you can listen behind a door, but only get info on
numbers of mobs/pc's in that room.

-----------------------

Date: Fri, 27 Nov 1998 17:14:42 -0700
From: Edward J Glamkowski <eglamkowski@angelfire.com>
To: George <greerga@circlemud.org>
Subject: Re: eavesdrop snippet

>> I put in to subscribe to the mailing list, but
>> haven't gotten added yet, and I know if I don't tell
>> somebody about this now, I'll forget later... ;)
>
>Want me to forward it?

Actually, you can forward the tested, working version ;)

at the beginning of act() in comm.c, add:
  struct char_data *evasdropper;

and then at the end of act():

  for (; to; to = to->next_in_room) {
    if (!SENDOK(to) || (to == ch))
      continue;
    if (hide_invisible && ch && !CAN_SEE(to, ch))
      continue;
    if (type != TO_ROOM && to == vict_obj)
      continue;
    perform_act(str, ch, obj, vict_obj, to);
  }

/* ADD EAVESDROP STUFF HERE: */

  /* Send action to any eavesdroppers in neighboring rooms */
  for (eavesdropper = world[ch->in_room].listening; eavesdropper;
       eavesdropper = eavesdropper->next_listener) {
    if (eavesdropper->desc) {
      /*  the ------'s are used to differentiate eavesdropped stuff from
       *  the stuff that is happening in the same room as the char..
       *  looks like:
       *  -------
       *  john dropped a sword
       *  ------
       */
      SEND_TO_Q("----------\r\n", eavesdropper->desc);
      perform_act(str, ch, obj, vict_obj, eavesdropper);
      SEND_TO_Q("----------\r\n", eavesdropper->desc);
    }
  }


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



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