Anatomy of a LambdaMOO db file

Authors: Robert Leslie <[email protected]>, Alex Stewart <[email protected]>

Mirrored from http://www.mars.org/home/rob/docs/lmdb.html

Disclaimer: Messing with the internals of LambdaMOO db files is inherently dangerous, and is not recommended. The following information is to be used at your own risk.


The db file is flat ASCII text organized into lines.

 [1] Object flags:          player      0x01
                            programmer  0x02
                            wizard      0x04
                            read        0x10
                            write       0x20
                            fertile     0x80

 [2] Verb permissions:      read        0x01
                            write       0x02
                            execute     0x04
                            debug       0x08
                            dobj arg    0x30  ("none", "any", "this")
                            iobj arg    0xC0  ("none", "any", "this")

 [3] Property permissions:  read        0x01
                            write       0x02
                            chown       0x04

Answers to Common Questions

How do I find a particular object?

Search the db file from the beginning for the string "#X" on a single line where X is the desired object number. Of course, you might find instead an object string property value which happens to contain the same text, so be sure you also check the following line, which should contain the name of the object you're looking for.

How do I remove/add/modify properties?

Adding or removing properties is treacherous; property definition counts and value counts must match exactly, and you must take into account property values on all descendents of the object in question.

You might be able to get away with modifying the value of a property if you're very careful. It might be hard to find the actual value in the db file, since it isn't obvious which values are matched with which property names. If the current value is something you could search for (say, if you knew an encrypted password beforehand and could search for it) you might have better luck.

How do I remove/add/modify verbs?

Removing verbs is easier by comparison. You must delete the four lines containing the verb definition in the object description where the verb lives, and decrement the verb count on the 12th line of the object definition. If the verb has been programmed, you should also remove the associated verb code in the latter portion of the db file and decrement the global verb count on the 2nd line of the file. There is one gotcha: by removing the verb, all later verbs in the object have been renumbered (recall the verb code section assigns code to verbs using a 0-based index) so you must renumber the tag lines for the affected verb programs accordingly.

It would be feasible to add a new verb by doing the reverse of this.

How do I remove active tasks?

You could eliminate all suspended tasks by replacing the last section of the db file containing task information with the following three lines:
0 clocks
0 queued tasks
0 suspended tasks
These lines should immediately follow the last verb program, and should be followed immediately by the end of file.

Are there any rough integrity checks I can perform by hand?

The above description is probably complete enough for you to decide whatever integrity checks are feasible and how to make them. However, testing a modified db with the real LambdaMOO server is probably the best way to be sure it is still at least usable. If there are minor problems, the server may even be able to compensate for some of them during its own rigid verifications.

I shouldn't need to emphasize that editing db files by hand is inherently dangerous. I really don't recommend any amount of significant hacking.

Also, although I am fairly confident the above description is correct, I am by no means making any guarantee about its accuracy, and certainly am not willing to accept responsibility for any damage done to anyone's db as a result of my making this public. Nonetheless, I hope it's useful to some.