Geas MUD, enter the Aventure!
Geas Home | Play the Game

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3.2 How to obtain object references

Objects, as previously described, comes in two kinds - master objects and clones. In general you tend to use cloned objects. At least for objects that are being 'handled' in the game, objects that you can move about, touch, examine etc, or any object that exist in more than one copy. Making exclusive use of only the master object is usually only done for rooms, souls or daemon objects of various kinds.

The master object should not be moved inside an inventory. It is technically possible to do so, but it'll generate a number of errors in various situations, so please just don't try it, ok? Master objects can have inventories of their own though, and that feature is used in rooms. Rooms, generally speaking, should never be cloned. The same goes for command souls and certain central daemon objects. For example, if you implement a bank with several offices, you will need some kind of central service which keeps track of customers and accounts for you. That central object should probably never be cloned, but instead exist as a non-clonable loaded object.

Naturally any object in the game must have a master object. An object is loaded into memory and the master object created when a function (any function call, even to a non-existing function) is called in it. Cloning it just makes identical copies of it. If you destroy the master object, the gamedriver will have to load it again later before making any new clones. Naturally this is what you do every time you have made changes to the object that you want to become active. Destroying the master object won't change the already existing clones, of course. You'll have to replace them separately.

NB! Remember that any object you have cloned and distributed in the game will continue to exist unchanged even though you destroy the master object. New objects that you clone from the updated master object will have the new functionality, but the old ones will remain the way they were previously. This means that if you have discovered a real bummer of a bug in some kind of object that you have distributed to a lot of players, you'd need to create another specialized object to find them and replace them with the new version to actually get the bug removed from the game.

The mudlib in fact works so that loading an object is made by calling a non-existing function in the object and updating it simply destroys the master object.

How to get the object references then? Well, that depends on the situation. An object reference is either an object pointer or a string path, referring to the object source in the mud filesystem. Obtaining them is different depending on the situation however. Let's go through them all. Object references relative to the current object  References relative to the current object Creating objects  How to create an object Finding references relative to another object  Find a reference relative to another object Object references to interactive objects  References to interactive objects Destroying objects  How to get rid of objects

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Ronny Wikh on July, 8 2003 using texi2html