Help

JS-DATABASE

For immortals Also: JAVASCRIPT-DATABASE, JS-DB

Players, rooms, objects, and mobiles all have a special database object associated with them. This database object is special in that any variables written to it will be retained even if a player logs out, a mobile dies, or if the mud gets rebooted. They are saved.

For example,

actor.db.completedDrowQuest = true;

The property "completedDrowQuest" would be saved in the database even if the mud was restarted. Currently only simple properties may be stored in the database which includes strings, booleans, and numbers. Other examples are:

actor.inRoom.db.visitors++;
subject.db.orcsKilled++;
if ( actor.db.orcsKilled > 20 ) ...


Note that for mobiles and objects, data is stored by vnum.  This means that
all objects with the same vnum have the same database.  All players have
their own database.


You can use the db option on the mstat, ostat, and rstat commands to
see the contents of the JavaScript database object for a given mobile,
object, or room.