Phantasmal MUD Lib for DGD

Phantasmal Site
Phantasmal API
Archive
DGD
Getting DGD
Game Design Issues
The Kernel Library
LPC
Writing a Library
Changing LPC
Object Cleanup
⁄cmd vs wiztool
Conditional Inheritance
Object Database
Distribute a State Dump?
Designing Driver Objs
FTPD
GurbaLib
HTTPD
State Dumps
Heaven7
InterMUD3
Interrupt Call
Designing AUTO Objs
Misc Issues
NFS
Object Binding
Object Management
Other Net Services
Persistent MUDLibs
Player vs Body
Precompiling
Reimplementing From Scratch
Releasing Code
Rlimits
Script Delays
Misc Security
Outgoing Email
So You Want To...
Start from Scratch?
Supplementary Documentation
Telnet Protocol
Using the Kernel
Using Melville
Using Phantasmal
WebDAV
Which License
What Does It Do?
DGD LPC Reference
Running a MUD
Skotos
CSharp vs DGD
Contributing to DGD
DGD Glossary
Java vs DGD
DGD MUDs
Miscellaneous DGD
MudOS vs DGD
Slush Bucket
Why Use DGD?
Design
Development
Innsmouth MUD
Phantasmal Operation
Setup
Test module index
Phantasmal Tutorials
Comparison to Other Libs
Credits
Current Features
History
Installing Baseline Phantasmal
About

How Can I Conditionally Inherit a File?

When a program includes a file, the path_include function is called in the driver object. By returning a different file name, you can change what file is included. You can then choose between including an empty file and one that inherits the program you'd like inherited.

The file must be valid either way, which is why you can't just have path_include return (nil) and include nothing at all.

Note that the standard include file (usually ⁄include⁄std.h) does not have path_include() called for it, so you can't redirect that one. However, you can #include a file from the standard include file, and redirect that one.

The Kernel Library does this in a slightly different way, but underneath it's doing the same thing. It uses AUTO as the name of the file included by the standard include file, which is why you need an empty file called AUTO to use this method.

Note that Kernel Library or not, you can use this for conditional inclusion, not just inheritance. So if you'd like to change what gets put into the standard header, just have it include another file (again, the Kernel uses AUTO as that name) and you can put different #includes and #defines in the different AUTO objects that you return under different circumstances. This is a great way to do scripting, because you can change the script's parent objects, predefined constants and standard library and AUTO-object functions, all without making the script itself have to include or inherit anything.

Phantasmal's test game, Seas of Night, is a good example of the scripting usage above. Have a look at its custom rooms in version 0.003 or later.