[DGD] Melville - Attention: Stephen Schmidt

Dannic dannic at orpgs.com
Tue Jan 21 03:44:44 CET 2003


On Sun, 19 Jan 2003, "Vampyr Twilight" wrote:

> 
> I'm looking at the room.c which in turn inherits
> container.c which in turn
> inherits object.c.
> I would like to be able to add the ability to add
> extraneous item
> descriptions to "objects"
> that are listed in the room description, but aren't
> really objects that can
> be manipulated.
> 
> No where in here do I see something of the
> funcationality of:
> 
>     add_item( ({ "gate", "large gate" }),
>     "The gate towers above you.  It's rusted bars
reach
> from the earth to
> the sky tipped with \n"
>     + "rusty spear heads as if to pierce the heavens
in
> their
> ignorance..\n");
> 
> I'm wondering what would be the most effcient way to
> add this.   Would I add
> the functionality
> into the object.c inhertiable, and then modify the
look
> command to search
> for that mapping, or
> am I making this more difficult then it needs to be?
> 
>     Thanks,
>     V. Twilight ;.,
> 
> 
A good way of looking at this is to look at some of the
other code.  I do this with a small bit of code that
may help you.  

/* allow items to be added to rooms.  These items are
not objects*/

mapping items;


void set_items (mapping itm) {
    items = itm ;
}
void add_item (string item, string str) {
    items += ([ item : str ]) ;
}
mapping query_items() {
	    if (!items) items = ([ ]) ;
    return copy(items) ;
}

string query_item (string item) {
    return items[item] ;
}

This will allow you to add "items" to be looked at. 
You will have to modifiy the look command to query the
mapping for what they are trying to look at.

You should put this in the room.c file.  Though if you
put it in the object.c file you can make any object a
little more descriptive.

Ever Play an online game?  Like to RP?

Visit 

Online Role Playing Games
http://www.orpgs.com

for your source of information about Online games.
_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list