Table of Contents

Module: stdlib mudlib/stdlib.py

Houses library of standard functions integral to the mudlib.

Imported modules   
import constants
from org.bluesock.bluemud.driver import Driver
import pickle
import stdprops
import string
import types
import utils
Functions   
cloneObject
findPlayer
getSharedObject
loadObject
log
saveObject
thisPlayer
write
  cloneObject 
cloneObject ( path,  shared=0 )

Create and return a new instance of an object.

Create a new instance of the object denoted by the given path and return it (unless the object is shared and already loaded, in which case a reference to the shared object is returned).

arguments:

path
(string) dotted path string for the object
shared=0
(int) 1 if it's a shared object, 0 if not

returns:

a MudObject instance

  findPlayer 
findPlayer ( playerName,  loadIfOffline=0 )

Retrieve a reference to a named player.

If the optional loadIfOffline is not provided or is false, then this function will return a reference to the named player only if they are currently online. If the loadIfOffline flag is true and the player is not online, then an instance of the player will be constructed from the player's file and returned. Note that this instance is not necessarily in the same state that it would be if the player were online. If a player with the given name does not exist, or is not online when the loadIfOffline flag is false, then None will be returned.

arguments:

playerName
(string) the player you're looking for
loadIfOffline=0
(int) 1 if we should load them if they're offline, and 0 if not

returns:

(mudlib.living.Player)

  getSharedObject 
getSharedObject ( path )

Retrieve a reference to a shared object.

If the object is not yet loaded, it will be loaded first. This function is equivalent to cloneObject with the shared parameter turn on.

arguments:

path
(string) the dotted path string for the object

returns:

a MudObject instance

  loadObject 
loadObject ( saveFileContent )

Load a previously saved object from the given save-file content.

A new instance will be created and its load method invoked. The loaded object will be returned, or None if loading fails.

arguments:

saveFileContent
(string) the string from loading the file

returns:

MudObject instance in the state it was persisted in

  log 
log ( logName,  entry )

Adds the given entry to the specified log. The log name should be the path of the desired log file relative to the log root. Entry should be the message written to the log. Note that a timestamp will be prepended to the entry and a newline will be appended to the entry.

arguments:

logName
(string) the name of the log to dump stuff into
entry
(string) the stuff to log

  saveObject 
saveObject ( object )

Generate representation of the given object that can be saved to disk.

Note that the object must have the stdprops.IS_PERSISTENT property set and must provide appropriate implementations of the save method. Also note that this method merely returns the representation, it does NOT write the representation to disk.

arguments:

object
(MudObject) the object to save
  thisPlayer 
thisPlayer ()

Return the player currently driving this path of execution.

returns:

???

  write 
write ( message )

Writes the given message to the current active player.

arguments:

message
(string?) writes the message to the player
Classes   
VBFC

Enables perspective-based dynamic messaging.


Table of Contents

This document was automatically generated on Thu Jan 24 08:57:43 2002 by HappyDoc version 2.0