Re: [Newbie] Adding a new object type

From: Karl Buchner (blaizeofshadow@juno.com)
Date: 03/06/01


To create a new object type, just drop
#define ITEM_WHATEVER                     XX
into structs.h, and add to the item_types list in constants.
if you use oasis, you have to increase NUM_ITEM_TYPES in oasis.h
now you have a new object type...now for the code...but first...
A side note...
If you have dgscripts, this would require only a very simple script...
if you dont have dgscripts, get it.  if you dont get it, use the
following code:
NOTE: Code is not verbatim, but you should get the general idea.
Dont cut and paste, it will screw up

wherever code for looking at an object is...insert
if (GET_OBJ_TYPE(obj) == ITEM_LINKBOOK)
      send_to_char(world[real_room(GET_VAL(obj, 0))].description);

then...
ACMD(do_touch){
    /*parse arg for an object, check to make sure obj is a LINKBOOK,
then*/
    send_to_char("Message, blah blah", ch
    char_from_room(ch);
    char_to_room(ch, real_room(GET_OBJ_VAL(book, 0)))
    return;
}

Quite obviously, the objects value #0 is the vnum of the object.  It will
take some
code to allow this to be set in OLC, but figure it out.

^Blaize^
________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
http://dl.www.juno.com/get/tagj.

--
   +---------------------------------------------------------------+
   | 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/04/01 PST