On Sat, 1 Dec 2001, David Cole wrote:
> Trying add petition, like the one on Sojourn III etc... I know you
> know what sojourn is :p
I don't think that's a safe assumption.
> [snip]
The reason your code doesn't write anything to the immortals is simply
this: it doesn't. Code is not magic. The program does not magically do
what you intend; rather it, it does what you tell it to do. So if you
want to send a message to all immortals, you need to do that. If there's
not a prepackaged function for doing that, you need to write the loop to
do it yourself. Here's a function that will send an act() to each
immortal that's on:
/* Mailer Code(tm) -- the usual caveat applies. */
void act_to_imms(const char *msg, struct char_data *ch)
{
struct descriptor_data *d;
/* Loop through everyone connected... */
for (d = descriptor_list; d; d = d->next) {
/* Skip connections not playing or without a character... */
if (STATE(d) != CON_PLAYING || !d->character)
continue;
/* Skip connection associated with the character, ch. */
if (d->character == ch)
continue;
/* Skip connections with non-immortal characters. */
if (GET_LEVEL(d->character) < LVL_IMMORT)
continue;
/* Now send the act to this connection's character. */
act(msg, FALSE, ch, 0, d->character, TO_VICT | TO_SLEEP);
}
}
An example of its use:
act_to_imms("$n is online.", ch);
Putting it to use in your specific case is left as an exercise for the
reader.
-dak
--
+---------------------------------------------------------------+
| FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
| Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
+---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/24/03 PDT