OBJECT
/obj/vmaster.c
SYNOPSIS
inherit "/obj/vmaster.c"
LAST UPDATE
Thragor, 12-Mar-97, 19:00 MET
DESCRIPTION
Akkording to the property 'P_VMASTER' the vmaster allows to
easily create such a virtual master. You may add objects with
their filename as key, i. e. the filename has to be unique in
one master.
There are only a few functions necessary to configure virtual
items in a room:
mapping P_OBJECTS
P_OBJECTS contains the informations about all objects
contained in the virtual master. The structure of the
mapping is:
([
<filename as key>:<file to clone>;
<properties of the virtual object>
])
mapping AddObject(string file,
string object-file,
mixed properties)
This is the main function of the virtual master. When a
virtual object gets compiled <object-file> gets cloned and
it gets configured with the properties-entries.
The property-variable is something special. The best thing
to describe it, are several examples:
([P_SHORT:"a test-item"])
ob->Set(P_SHORT,"a test-item") will be called.
({
([P_STANDARD:({AT_HELMET,1,PSIZE_NORMAL})]),
([P_SHORT:"a helmet"])
})
First call P_STANDARD and THEN configure with the
following properties. This should be used if some
properties have to be set before everything else.
({
([P_INT_SHORT:"a room"]),
({"SetIntLong","A boring description.\n"}),
({"AddDetail",({"description","boring description"}),
"A boring description, too.\n"
})
})
If instead of the properties-mapping an array is given,
this will be used to call functions. In this case the room
gets first an IntShort and then
ob->SetIntLong(...);
ob->AddDetail(({...}),...);
are called.
For someone who's interested in the interna: The call is
done with apply() using the first array-entry as function
and the rest as arguments.
status QueryObject(string file,
string object-file,
mixed properties)
To query, if a file exists and to get the data of the file
when it exists, QueryObject() may be used. It returns 0 if
the file doesn't exist in the database and 1, if it
exists. If the file exists and <object-file> and
<properties> got called by reference they'll contain the
according values afterwards.
object compile_object(string file)
As described in vmaster(p), this function is called to
compile the object. It gets the file to compile as argument
and returns an object-pointer to the configured file.
SEE ALSO
vmaster (p)