Table of Contents

Class: Actor pubobjs.py

Base class of People or other active Creatures. Implements agent-like behavor.

This will probably be the parent class of agent-extensions to PUB. (See NPC for what will probably be expected of them.

base class of any person, monster, or other chanacter

Base Classes   
Container
Methods   
Act
Announce
DoCommandString
DoNextCmd
FindNoun
GetName
LocalNouns
NameToObj
PreAct
__init__
  Act 
Act ( self )

Does nothing
overload?
  Announce 
Announce ( self,  pWhat )

Speak to the room
This character says something which is heard by everyone in the Room (more precisely, the container).
  DoCommandString 
DoCommandString ( self,  cmdstr )

Interpret a command to the actor. --

If first word is an Actor's name, interpret it as a "say" action.

There's a concept here of a command list, which I hope will become clear from other parts of the code.

Anyway, this code executes the first command as it's last act (presumeably the command list is completed by some other part of the code -- perhaps commands consume turns?).

  DoNextCmd 
DoNextCmd ( self )

Do the next command in the list
The command interpretation process. When complete, adds the next command via the "Scheduler".

So commands consume turns or time.

  FindNoun 
FindNoun (
        self,
        pName,
        cmd=None,
        )

Find a thing if in the room
Given the name of a noun, return the visible object. Returns None if the noun can't be found (?).

given the name of a noun, return the visible object

  GetName 
GetName (
        self,
        article=0,
        pLooker=None,
        )

Get the actor's name.
By default, no article will be used with it (e.g. we don't say "a John is here", we say "John is here").
  LocalNouns 
LocalNouns ( self )

Everything visible from the room. --

Gets a list of objects in visible/reachable range.

There's a note here about extending it to include container's container in the search. (Not sure if that's a good idea).

get list of objects within visible/reachable range

  NameToObj 
NameToObj (
        self,
        pName,
        cmd=None,
        )

Find a thing in the room
Given the name of a noun, return the visible object. If not found, returns the name (first argument to this method).

similar to above, but if it can't find the object, return the given string

  PreAct 
PreAct ( self,  cmd )

Gets called before doing things
Gets called before doing things. Notably, if the actor has "followers" (actors who follow it, presumeably), they are commanded to follow when this actor moves.

(This seems to be its only current use).

  __init__ 
__init__ ( self,  pNames='' )


Table of Contents

This document was automatically generated on Mon Aug 8 17:04:06 2005 by HappyDoc version 2.1