Login   Register  
PHP Classes
elePHPant
Icontem

File: FEATURES.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of JImmy Bo  >  Weller MUD Area Loader  >  FEATURES.txt  >  Download  
File: FEATURES.txt
Role: Documentation
Content type: text/plain
Description: Current list of features and usage
Class: Weller MUD Area Loader
Parse and manipulate Weller MUD map area files
Author: By
Last change: more info on caching feature
Date: 2013-10-19 14:12
Size: 3,158 bytes
 

Contents

Class file image Download
** new: 10/19/2013
  add a writeable directory called [area_edit_cache] in the same directory as area_edit.php
  -- this should result in around a 40x speed improvement in room->area lookup.
  -- look at function draw_rooms() in class.weller.mud.render.php
  -- you can also activate the benchmark just before the return of that function.


Can load and integrate change files to an area. This allows for non-destructive area editing. You can do this by making a changes file in the area's directory that you wish to change/add data too. eg) wellermud.changes.rooms.php would be where you would add/change rooms;  wellermud.changes.mobs.php would be where you would add/change mobs; etc...

I recommend putting new data in the changes file, so that if you regenerate the area with say a more recent parser, your changes won't be wiped out. I'm also working on a history system for the changes files, so occasionally you can archive the past changes and remove redundancy.


Example [wellermud.changes.resets.php]

<?php
$area["chapel.are"]["resets"][] = 
  array (
    'comment' => 'the priest',
    'command' => 'load mobile room',
    'vnum' => 
    array (
      'mob' => '3405',
      'room' => '3405',
    ),
    'data' => 'M 0 3405 1 3405 1'
  );
 
  // leave end of php open so that data can keep being appended to the change file.
  // it won't mess anything up l




You can generate a world from a stock ROM MUD install using [class.load.rom.area.php] @ http://www.phpclasses.org/package/8282-PHP-Load-ROM-MUD-area-map-files-into-arrays.html


[class.weller.mud.php]
Basic Usage: 
<?php
	include_once('class.weller.mud.php');

	$wmud = new weller_mud_world('test_world/'); // make object and set world data directory
	$area_list = $wmud->get_area_list(); // loads the area list into an array in $area_list

	$wmud->load_area('midgaard.are'); // load some area
	$wmud->load_area('midennir.are'); // load some more areas

	$wmud->process_area_resets('midgaard.are'); // load objects, mobs, doors into their places in the area


	
	// you can also fetch data individually like so...

	$aroom 		= $wmud->get_room(3001); 	// load midgaard.are for this # fetch a single room
	$aobject 	= $wmud->get_object(3000); 	// load midgaard.are for this # fetch a single object
	$amob 		= $wmud->get_mob(3000); 	// load midgaard.are for this # fetch a single mob

?>


[class.weller.mud.render.php]
Basic Usage:
<?php
	// the render engine is a simpler way of parsing the output for multiple devices 
	// eg) mobile, web browser, etc

	include_once('class.weller.mud.render.php');

	// if you look at the above example for [class.weller.mud.php] you will see how their fates are intertwined
	$wmud->load_render_engine($wmud); // add the render engine to the area reader. Pass the parent object while we are at it.

	// then you can access it's special little functions like:
	$wmud->render->drop_down('area_list','myAreaList','[ areas ]');
	
	// this should make it easy to make editors, game engines off of...
	// check out area_edit.php for an example editor using these two classes.
?>