Your browser must have JavaScript enabled in order to view this page.
 >  >
 
Welcome Guest#9586 Login/register    Go to Bottom
Go to Top
 > Inner workings of DutchPIPE   DutchPIPE Jargon >
Important Concepts

Important Concepts

IMPORTANT CONCEPTS WITHIN A DUTCHPIPE UNIVERSE

 > The dpuniverse/ directory
 > Filename based classes
 > The universe object
 > The standard class
 > Other standard classes
 > Inventory, environment
 > Moving objects

The dpuniverse/ directory

Your universe is constructed from objects in the following directory:

dpuniverse/

The dpuniverse/ directory contains subdirectories for pages, "non playing characters" (bots) and other objects: dpuniverse/page/, dpuniverse/npc/ and dpuniverse/obj/.

Filename based classes

Each .php file within dpuniverse/ should contain only one class, with the classname the same as the filename, without .php, and the first letter in upper case. For example:

dpuniverse/page/bar.php defines class Bar

Class names must be unique. See DutchPIPE Issues for more information about this limitation.

The universe object

The universe object is created when the DutchPIPE server is started, keeps track of all objects in the site and sports a number of important methods you can call.

A reference to the universe object is obtained by the get_current_dbuniverse() method. Example:

  1. $universe get_current_dbuniverse();
  2. $note $universe->newDpObject('/obj/note.php');

See DpUniverse for a list of callable methods in this object.

The standard class

Each object extends on the DpObject class from dpuniverse/std/DpObject.php, either directly, or by using a class that extends on it.

Other standard classes

Other standard classes provide several building blocks for your site:

DpPage to make a page;

DpNpc to make a non playing character (a bot);

DpDrink to make a drink.

They all extend on DpObject.

Inventory, environment

Objects can "contain" other objects. You can call the getEnvironment and getInventory methods in all objects to see how they are related to the objects surrounding them or contained in them:

  1. /* List of what the user is carrying */
  2. $inv $user->getInventory();
  3. foreach ($inv as &$ob{
  4.     get_current_dpuser()->tell($ob->getTitle('<br />');
  5. }
  1. $env $note->getEnvironment();
  2. if ($env->getProperty('is_page')) {
  3.    ... /* The note is sitting on the page */
  4. elseif ($env->getProperty('is_user')) {
  5.    ... /* Someone is carrying the note */
  6. }

Moving objects

Call moveDpObject in objects to move them around, for example:

  1. /* Moves note to inventory of user */
  2. $note->moveDpObject($user);
  3.  
  4. /* Moves note to page */
  5. $note->moveDpObject($user->getEnvironment());

 > Inner workings of DutchPIPE   DutchPIPE Jargon >

Documentation generated on Mon, 03 Sep 2007 22:17:54 +0200 by phpDocumentor 1.3.0RC6

Click me!
Guest#9586
 
 
 
  Go to Top
 
 
Input Field OptionsClose Input Field Go to Top
 
Legal Notices | Copyright © 2006, 2007 Lennert Stock. All rights reserved. Last update: Mon Sep 03 2007, 21:50 CET.