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

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

1.1.5 Object makeup

An object is comprised of something called functions and variables. A function is a set of instructions you can reference by a name. A variable is a kind of container you can store data in for use by the functions. Some functions are already defined by the gamedriver, they are called external functions, or efuns. Functions defined in LPC code are called local functions, or lfuns. To confuse matters further there is a set of functions that count as efuns, but are written in LPC. These functions are called simulated efuns or sfuns.

An efun basically is a function that is impossible to create in LPC. Take for example the function write() that allows you to present text on the screen of a player. It's impossible to make that up from other functions in LPC, so it has to be in the gamedriver. This efun is available in all LPC programs. Efuns also have no idea about what environment they are used in. They don't care one bit if they are used to simulate strawberry tasting, or as part of a game.

A function like add_exit() on the other hand, that adds an exit in a room is only available in room type objects. It is written in LPC. The lfuns as a rule are part of the makeup of the environment in which the objects are used. The example add_exit() for instance is well aware of such ideas as directions and travel costs, a very limited and specific concept.

The function creator() is a good example of the third case. It's a function that is available in every object, it returns information about who created a certain object. This information is very specific to the environment since it deals with such notions as code localization. This kind of function is easy to write in LPC but on the other hand it must be available in all objects, as if it was an efun. Due to this fact the special object `/secure/simul_efun.c' is made to be automatically available from all other objects in the game, you'll find all sfuns in there. This functionality is perfectly transparent to you; you just use them as you use any other efun and you don't have to be aware of that it really is an sfun.

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

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