Re: Compare Code

From: Mark Garringer (zizazat@hotmail.com)
Date: 10/18/02


> >  if (!(obj2 = get_obj_in_list_vis(ch, arg2, NULL, ch->carrying))) {
> >    for (j = 0; j < NUM_WEARS && !found; j++)
> >      if (GET_EQ(ch, j) && CAN_SEE_OBJ(ch, GET_EQ(ch, j))) {
> >        if (isname(arg2, GET_EQ(ch, j)->name)) {
> >          obj2 = GET_EQ(ch, j);
> >          found = TRUE;
> >        } else {
> >          send_to_char(ch, "Debug2: You do not have that item.\n\r");
> >          return;
> >        }
> >      }
> >  }
> >
> >Can someone please show me the error of my ways?
>
>You should use generic_find().

  if (!(generic_find(arg2, FIND_OBJ_INV| FIND_OBJ_EQUIP, ch, &tchar,
&obj2))) {
    send_to_char(ch, "Debug2: You do not have that item.\r\n");
    return;
  }

This seems to work much better! :)

Thanks for the tip!

--Ziz

_________________________________________________________________
Get a speedy connection with MSN Broadband.  Join now!
http://resourcecenter.msn.com/access/plans/freeactivation.asp

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT