
01-16-2007, 03:50 AM
|
|
Incubator
|
 |
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
|
|
|
In my mudlib, all items are simply arrays: clientr.mud.item<uniqueid>
Anytime you make an item it gets a unique ID from the
serverr.mud.item.counter, this is so items dont overwrite eachother if you trade or anything like that since you're going to move the whole array.
The most important part of item data is the type which is the first var in array, the type is how you're going to know what stuff is where in the item array. All types are defined in serverr strings so they're easily available.
When you want a variable from an item, such as them name, you use:
mud_getitemvar(itemid, varname);
Or for example, mud_getitemvar("2006","name");
What this does is looks for the item in the clientr strings. When it finds the item, it looks at the item type (index 0) and loads the list of vars from that, and returns the index of the item array that matches the varname's index in the varlist. If you already know the index you simply use:
mud_getitem(id, index);
Any index less than zero returns the whole item array.
For updating the player, when you log in the mudlib compares your items with the archetypes that are loaded into the server, if there is a difference the mudlib updates all the variables except the 'noupdvars' such as the quantity, type, and archetype. Custom items lack an archetype so they're not updated. |
|
|
|