Specification
- Released January 30th, 2011.
- Defines the object dmp_suite
- Provides the proc load_dmp()
- Loads the specified map file onto the specified z-level.
- Provides the proc write_map()
- Returns a text string of the map in dmp format
ready for output to a file.
- Provides the proc save_map()
- Returns a .dmp file if map is saved
- Returns FALSE if map fails to save
- Automatically Saves the .dmp file in the world's directory
- Note: Because of this behavior, save_map() is being phased out, it is suggested that you use write_map() instead.
The dmm_suite provides saving and loading of map files in BYOND's native DMM map
format. It approximates the map saving and loading processes of the Dream Maker
and Dream Seeker programs so as to allow editing, saving, and loading of maps at
runtime.
Usage Notes
Saving Maps
To save a map at runtime, create an instance of the dmm_suite, and then call write_map(), which accepts three arguments:
- A turf representing one corner of a three dimensional grid (Required).
- Another turf representing the other corner of the same grid (Required).
- Any, or a combination, of several bit flags (Optional):
- DMM_IGNORE_AREAS : the writer will write all turfs as contained in world.area
- DMM_IGNORE_TURFS : grid locations will be filled with the world.turf typepath
- DMM_IGNORE_OBJS : objects will not be saved
- DMM_IGNORE_MOBS : mobs will not be saved.
- Note: DMM_IGNORE_MOBS == DMM_IGNORE_PLAYERS & DMM_IGNORE_NPCS
- DMM_IGNORE_PLAYERS : mobs with attached clients will not be saved
- DMM_IGNORE_NPCS : mobs without attached clients will not be saved
The order in which the turfs are supplied does not matter, the /dmp_writer will determine the grid containing both, in much the same way as DM's block() function. write_map() returns a text string representing the map in dmp format, which can then be output to a file:
var/dmp_file = file("my_map.dmp")
dmp_file << write_map(turf1, turf2, DMP_IGNORE_PLAYERS)
Loading Maps
To load a map at runtime, create an instance of /dmm_suite, and then call load_map(), which accepts two arguments:
- A .dmm file to load (Required).
- A number representing the z-level on which to start loading the map (Optional).
The /dmm_suite will load the map file starting on the specified z-level. If no z-level was specified, world.maxz will be increased so as to fit the map. Note that if you wish to load a map onto a z-level that already has objects on it, you will have to handle the removal of those objects. Otherwise the new map will simply load the new objects on top of the old ones.
Also note that all type paths specified in the .dmm file must exist in the world's code, and that the /dmm_reader trusts that files to be loaded are in fact valid .dmm files. Errors in the .dmm format will cause runtime errors.
Version History
- 1.1
- Released January 30th, 2011
- Combined the /dmp_reader and /dmp_writer libraries, and rebranded as the dmm_suite.
- Added an extra argument to the load_map() proc so as to allow maps to be loaded on any z-level.