Re: Building or coding problem?

From: Welcor (welcor@dune.net)
Date: 08/04/01


I'd say coding problem - see below

> It seems it is just showing the extra description for the rose, not the long
> description. Thats why I asked.
> If it displays the extra description, which it appears to be, it will
> not show the glowing effect.. Change the keyword for the extra description
> and see if it works for ya.
>
This all occurs due to the implementation of 'look at <object>'. Currently
the code first does a generic_find(), then searches through the eq, inventory
and room of the caller to find a matching extra description. If an extra desc
is matched, it's shown. However, if an object _was_ found in the first call
to generic_find(), it's the appropriate effect (glow, hum, etc) that's shown.
This means, that if an object (obj1) has the same keywords as the extra
description of something in the room/on the character, obj1's effects will
be sent after the extra description.

the result is:

obj1  name: white rose        - extra desc: rose             bits: glow
obj2  name: moonstone         - extra desc: white moonstone  bits: none

'l rose' -> obj1 found, extra desc for obj1 shown, then effects for obj1
'l moonstone' -> obj2 found, extra desc for obj2 shown

'l white' -> obj1 found, extra desc for obj2 shown, then effects for obj1

This is buggy behaviour - change the following to show only effects
belonging to a particular object (sorry about the formatting):

in act.informative.c:void look_at_target

 /* Does the argument match an extra desc in the char's equipment? */
  for (j = 0; j < NUM_WEARS && !found; j++)
    if (GET_EQ(ch, j) && CAN_SEE_OBJ(ch, GET_EQ(ch, j)))
      if ((desc = find_exdesc(arg, GET_EQ(ch, j)->ex_description)) != NULL && ++i == fnum) {
 send_to_char(desc, ch);
+ found_obj = GET_EQ(ch,j);
 found = TRUE;
      }

  /* Does the argument match an extra desc in the char's inventory? */
  for (obj = ch->carrying; obj && !found; obj = obj->next_content) {
    if (CAN_SEE_OBJ(ch, obj))
      if ((desc = find_exdesc(arg, obj->ex_description)) != NULL && ++i == fnum) {
 send_to_char(desc, ch);
+ found_obj = obj;
 found = TRUE;
      }
  }

  /* Does the argument match an extra desc of an object in the room? */
  for (obj = world[ch->in_room].contents; obj && !found; obj = obj->next_content)
    if (CAN_SEE_OBJ(ch, obj))
      if ((desc = find_exdesc(arg, obj->ex_description)) != NULL && ++i == fnum) {
 send_to_char(desc, ch);
+ found_obj = obj;
 found = TRUE;
      }

That should do the trick. Usual disclaimer applies - use at own risk, etc.

Welcor

--
   +---------------------------------------------------------------+
   | 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 : 12/06/01 PST