[CODE] Info Channel

From: Pat O'Laughlin (polaughlin@STARIX.NET)
Date: 06/25/98


For anyone who was wondering how to put an info channel on your MUD
(when player enters game, dies, levels etc.), here is how I did it:

*** utils.h - at the bottom of the file ***

void infochan(char *str, int level)
{
  char buf[MAX_STRING_LENGTH];
  extern struct descriptor_data *descriptor_list;
  struct descriptor_data *i;
  char *tmp, tp;
  time_t ct;

  sprintf(buf, "&B[Info] : &Y%s&n\r\n", str);

  for (i = descriptor_list; i; i = i->next)
    if (!i->connected && !PLR_FLAGGED(i->character, PLR_WRITING)) {
      tp = ((PRF_FLAGGED(i->character, PRF_LOG1) ? 1 : 0) +
     (PRF_FLAGGED(i->character, PRF_LOG2) ? 2 : 0));

      if ((GET_LEVEL(i->character) >= level)) {
 send_to_char(buf, i->character);
 send_to_char(CCNRM(i->character, C_NRM), i->character);
      }
    }
}

*** end utils.h ***

To use this, do something like this at the appropriate section of the
code:

  sprintf(buf, "%s has entered the game.", GET_NAME(ch));
  infochan(buf, MAX(0, GET_INVIS_LEV(ch)));

NOTE: This uses the easycolor code... change the &B and &Y to whatever
you want.


     +------------------------------------------------------------+
     | 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