send_to_zone (fwd)

From: Jeff (jfink@csugrad.cs.vt.edu)
Date: 08/22/94


grruffin@netcom.com (Giovanni Ruffini) writes:
> I've been trying to figure out the best way to do a send_to_zone in the
> same vein as send_to_room, send_to_all, etc, but I've never been really
> good at reconciling rnums and vnums for rooms and zones, and that's pretty
> important for a piece of code like that, so if any of you have done
> anything like this, or have ideas how it should be done, I'd appreciate
> input. I'm envisioning calling send_to_zone from spec_procs, or anything
> like that, but I'm not sure if it would be best to send the zones rnum or
> vnum as a parameter, or from there, how to get the rnums of the lower
> and upper ranged rooms in the zone (I was considering a loop of send_to_
> rooms, but that doesn't strike me as very efficient).
> Ideas, anyone?


Here's what we use for a "zecho" command for Circle v2.01:


ACMD(do_zecho)
{
   int  i;
   struct descriptor_data *pt;

   if (IS_NPC(ch))
      return;

   for (i = 0; *(argument + i) == ' '; i++)
      ;

   if (!*(argument + i))
      send_to_char("That must be a mistake...\n\r", ch);
   else {
      sprintf(buf, "%s\n\r", argument + i);
      for (pt = descriptor_list; pt; pt = pt->next)
         if (!pt->connected && pt->character && pt->character != ch &&
                world[pt->character->in_room].zone == world[ch->in_room].zone)
            act(buf, FALSE, ch, 0, pt->character, TO_VICT);
      if (PRF_FLAGGED(ch, PRF_NOREPEAT))
         send_to_char("Ok.\n\r", ch);
      else
         send_to_char(buf, ch);
   }
}



You'll need to change it to ask for a zone argument, but other than that,
it should work fine.

-Jeff



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