Re: [CODE] [NEWBIE] loading objects

From: John Evans (evansj@HI-LINE.NET)
Date: 11/23/97


On Sun, 23 Nov 1997, dmodem wrote:

> struct obj_data *objections
>
> /* here is where I'm having trouble.  could I use
>  * objections = GET_OBJ_VAL(obj, 0);
>  * and the obj is (obviously) an object.  GET_OBJ_VAL(obj, 0) is the vnum
> of another
>  * object.  I need to get it's short description and display it now.
>  */

Try this:
  struct obj_data *objections;
  objections = read_object(GET_OBJ_VAL(obj, 0), VIRTUAL);
  /* read_object() is declared and mainly used in db.c */

> Also I want to check someone's inventory for this item (the one that is
> objections) and if they have one I want to take it away from them.  Not
> sure how to search through someone's inventory to find this item but I can
> easily find the code to take it from them (in fact I already did).  also

  struct obj_data *obj, *next_obj;
  for (obj = ch->carrying; obj; obj = next_obj) {
    next_obj = obj->next_content;
    if (GET_OBJ_VNUM(obj) = 42) {  /* CHANGE THE '42' TO MEET YOUR NEEDS */
      act("$P sizzles, fries, and flames out of existance.",
          FALSE, ch, obj, 0, TO_CHAR);
      obj_from_char(obj);
      extract_obj(obj);
    }
  }

John Evans <evansj@hi-line.net>

May the source be with you.


     +------------------------------------------------------------+
     | 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/08/00 PST