Re: Old Solutions

From: Iggy (bdogan@public.srce.hr)
Date: 07/16/96


On Mon, 15 Jul 1996, Demetrius Harris wrote:

> Anyway does anyone have the following code:
> 
>    The code that allows you to multiple thing as one with a number beside it
>    For example:
>       The beastly fido is mucking ..
>       The beastly fido is mucking ..
>       The beastly fido is mucking ..
> 
>    Instead you  see
>  
>       [3] The beastly fido is mucking ..


OK, here is the function which controls that and how it should look like.
-------------------------------------------------
void list_char_to_char(struct char_data * list, struct char_data * ch)
{
  struct char_data *i, *j;
  int num, infra;
  char buf[10];

  infra = 0;

  for (i = list; i; i = i->next_in_room)
  {
   if (ch==i) continue;

   if (!IS_NPC(i))
     {
     if (CAN_SEE(ch, i))
       list_one_char(i, ch);
     else if (IS_DARK(ch->in_room) && !CAN_SEE_IN_DARK(ch) &&
               IS_AFFECTED(i, AFF_INFRAVISION)) infra++;
     continue;
     }
 
   for (j=list; j!=i ; j=j->next_in_room)
      {
      if (i->nr==j->nr) break;
      }
 
   if (j!=i) continue;
   num=0;

   for (j=i;j;j=j->next_in_room)
       if ((j->nr==i->nr)) num++;
      if (CAN_SEE(ch, i))
        {
        if (num!=1){
                   sprintf(buf,"[%2i] ",num);
                   send_to_char(buf,ch);
                   }
        list_one_char(i, ch);
        }
      else if (IS_DARK(ch->in_room) && !CAN_SEE_IN_DARK(ch) &&
               IS_AFFECTED(i, AFF_INFRAVISION)) infra+=num;
   }
    if (infra)
        {
        sprintf(buf,"[%2i] ",infra);
        send_to_char(buf,ch);
        send_to_char("You see a pair of glowing red eyes looking your way.\r\n", ch);
    }
}
 

Iggy



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