Python Universe Builder

Standard Objects Reference

Things

All things in the game should be derived from Thing (below). Although Thing is itself derived from BaseThing, defined in pubcore.py, you should never need to access BaseThing directly.

Thing: base class of all things in the game
This is the base class of everything you see in a game -- Rooms, Containers, Actors, whatever. It has a lot of attributes, but many of them don't even need to be defined, and they all have sensible default values. The only required attributes are the name and synonyms, and these are set automatically when you create the Thing.
Attributes
.a article to be used in place of "a" (e.g., "a rock")
.container object which contains this Thing
.defverb Verb object to be called when no verb is given
.desc description (if any)
.light light given off by this Thing
.initialNote note to be used before this Thing is moved
.initialDesc desc to be used before this Thing is moved
.invisible invisibility level (usually 0 or 1)
.listening TRUE if this Thing wants Tell() calls
.name primary name, as it appears in descriptions
.note printed in list of room contents
.salient TRUE if this should show in list of room contents
.size mass or volume (100 = human)
.synonyms list of names by which this Thing can be called
.the article to be used in place of "the" (e.g., "the rock")
Methods
.__init__(names) initialize; e.g. rock = Thing("rock,stone")
.GetName(article=0) return name with article; e.g., rock.GetName(The) returns "The rock"
.(article=0) alternate for GetName(); e.g., rock(a) returns "a rock"
.NameMatch(str) returns TRUE if this could be called str
.GetNote() return string for room contents list
.GetDesc() return description of the Thing
.GetRoom() return first Room which contains this Thing
.CanSee(obj) return TRUE if this can "see" obj, assuming it's present
.Tell(str,cmd=None) tell this object the string, after substituting object names etc. from command cmd
.PreObj(cmd) check validity of cmd; return OK or CANCEL
.PostObj(cmd) post-process cmd; return OK for normal output
.PreMove(dest) OK to move this to dest? return OK or CANCEL
.PostMove(dest) called after the object is moved
.MoveTo(dest) attempt to move this to dest

(Other objects not yet documented)


http://www.strout.net/python/pub/doc/lib/objref.htm
Last Modified: 5/08/96 . . . . . . Joe Strout . . . joe@strout.net