act, act_new are designed to send to a specific player, or those in the
room.

If you want to send to all the players online you need to:


void
announce (char *string, CHAR_DATA * ch)
{
   DESCRIPTOR_DATA *d;

   for (d = descriptor_list; d != NULL; d = d->next)
     {
        CHAR_DATA *victim;

        victim = d->original ? d->original : d->character;

        if (d->connected == CON_PLAYING
            && d->character != ch
            && IS_SET (victim->comm, COMM_ANNOUNCE)
            && !IS_SET (victim->comm, COMM_QUIET))
          {
             if (!can_see(d->character, ch))
               continue;
             act_new (string, ch, NULL, d->character, TO_VICT, POS_DEAD);
          }
     }
   return;
}

Or whatever. Customize to needs.

> -----Original Message-----
> From: Michael Weiss [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 05, 2001 10:28 AM
> To: Jason Gauthier
> Cc: [email protected]
> Subject: RE: Announcment Syntax for multiple variables
> 
> 
> Hmm.. tried this code.. and it prints out great. But it only 
> sends to the
> person designated as (ch). Not as a global announcement.  Any ideas?
> 
> I used the following :
> 
> sprintf(buf, "{c[{RARENA{c] Let is be known that {C%s {chas 
> defeated {C%s
> {cin mortal combat.", PERS(ch, ch), PERS(victim, ch));
>     act_new(buf, ch, NULL, NULL, TO_ALL, POS_DEAD);
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Jason
> Gauthier
> Sent: Tuesday, December 04, 2001 7:13 PM
> To: 'Jef Waite'; [email protected]
> Subject: RE: Announcment Syntax for multiple variables
> 
> 
> ack! bad :)
> 
> > sprintf(buf, "[Announcement by $n] Player %s and Player %s have done
> > something", victim1->name, victim2->name);
> >
> > act_new(buf, ch, NULL, NULL, TO_ALL, POS_DEAD);
> >
> > Other than that, I'm not sure what you're trying to do...
> 
> You should never dereference '->name' directly unless it's an 
> immortal.
> If you do, your players lose the benefits of invisibility and 
> blindness.
> If you have to refer to a player, and act won't cut it, use PERS.
> 
> ----------------------
> sprintf(buf, "[Announcement] Player %s and Player %s have done
> something", PERS(victim, ch), PERS(victim2, ch));
> 
> act_new(buf, ch, NULL, NULL, TO_ALL, POS_DEAD);
> ------------------------
> 
> I know it was just sample code, but implies bad practice :)
> 
> Jason, who has a 60 line PERS() function.
> 
> --
> ROM mailing list
> [email protected]
> http://www.rom.org/cgi-bin/mailman/listinfo/rom
> 
> 
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
> 

Reply via email to