Re: Combining multiple objs when looking

From: Iggy (bdogan@public.srce.hr)
Date: 06/30/96


On Thu, 27 Jun 1996, David Blocher wrote:

> I think this was brought up before but what is the most effecient way to
> make several object appear only once when you look in a room. Like:
> A short sword lies here.
> A short sword lies here.
> A short sword lies here.
> A short sword lies here.
> A short sword lies here.
> A short sword lies here.
> Instead you would see:
> A short sword lies here. [x6]

In the act.informative.c file change the list_obj_to_char function with
this:
------------------------------------
void list_obj_to_char(struct obj_data * list, struct char_data * ch, int mode,
                           bool show)
{
  struct obj_data *i, *j;
  char buf[10];
  bool found;
  int num;

  found = FALSE;
  for (i = list; i; i = i->next_content) {
  num = 0;
    for (j = list; j != i; j = j->next_content)
       if (j->item_number==NOTHING) {
         if(strcmp(j->short_description,i->short_description)==0) break;
         } else if (j->item_number==i->item_number) break;
       if (j!=i) continue;
         for (j = i; j; j = j->next_content)
            if (j->item_number==NOTHING) {
              if(strcmp(j->short_description,i->short_description)==0) num++;
              } else if (j->item_number==i->item_number) num++;

    if (CAN_SEE_OBJ(ch, i)) {
      if (num!=1)
     {
      sprintf(buf,"(%2i) ",num);
      send_to_char(buf,ch);
     }
      show_obj_to_char(i, ch, mode);
      found = TRUE;
    }
  }
  if (!found && show)
    send_to_char(" Nothing.\r\n", ch);
}
----------------------------------------

The result will be: (x) <obj> .


Iggy



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