Table of Contents

Class: NPC mudlib/living.py
Base Classes   
Interactive
Methods   
addAsk
addRandomAction
addRandomChat
ask
command
createInteractive
createNPC
destroyInteractive
destroyNPC
heartbeat
introducedTo
rawwrite
removeAsk
removeRandomAction
removeRandomChat
setActionProbability
setChatProbability
setMobile
setMoveProbability
setRandomActions
setRandomChats
write
  addAsk 
addAsk (
        self,
        askwhat,
        function,
        )

Adds an ask to the NPC.

Asks are a method of interactivity between the players and NPCs. They can be triggered by the player typing "ask <askwhat>".

arguments:

askwhat
(string) usually one word string that will trigger a function
function
(function) a function to handle the ask
  addRandomAction 
addRandomAction ( self,  action )

Adds a random action.

Actions are executed just as if a player typed a command. Thus the action string is something like emote thinks a bit. or perhaps east.

arguments:

action
(string) the action to do
  addRandomChat 
addRandomChat ( self,  message )

Adds a chat to the NPC.

NPCs have a heartbeat and can say random things to appear as though they were alive during their heartbeat cycle.

arguments:

message
(string) the thing to say
  ask 
ask ( self,  askwhat )

Handles asks that the NPC knows about.

When a player "asks" an NPC something, it kicks off this function which looks up the "ask" and executes the function it's mapped to.

arguments:

askwhat
(string) the thing asked
  command 
command ( self,  command )

Processes commands.

arguments:

command
(string) the command to execute
  createInteractive 
createInteractive ( self )

  createNPC 
createNPC ( self )

  destroyInteractive 
destroyInteractive ( self )

  destroyNPC 
destroyNPC ( self )

  heartbeat 
heartbeat ( self )

The heartbeat function.

Don't call this--it gets called by the driver for each heartbeat of the mud. It cycles through basic NPC stuff like whether the NPC did a random chat or a random action.

  introducedTo 
introducedTo ( self,  knownInteractive )

When someone introduces themselves, the NPC returns the favor.

Note: an NPC won't introduce themselves to another NPC.

arguments:

knownInteractive
(mudlib.living.Interactive) the interactive who just introduced themself
  rawwrite 
rawwrite ( self,  message )

Handles raw data going from the mud to this NPC.

arguments:

message
(string)
  removeAsk 
removeAsk ( self,  askwhat )

Removes an ask from an NPC.

see addAsk

arguments:

askwhat
(string) the ask to remove
  removeRandomAction 
removeRandomAction ( self,  action )

Removes an action from the random action list.

arguments:

action
(string) the action to remove from the list
  removeRandomChat 
removeRandomChat ( self,  message )

Removes a chat from the list.

arguments:

message
(string) the chat to remove
  setActionProbability 
setActionProbability ( self,  heartbeatInterval )

Sets the random action probability.

arguments:

heartbeatInterval
(int) ???
  setChatProbability 
setChatProbability ( self,  heartbeatInterval )

Sets the chat probability.

arguments:

heartbeatInterval
(int) ???
  setMobile 
setMobile ( self,  isMobile )

Sets whether or not the NPC is mobile.

This affects the random actions the NPC may take during a heartbeat to make them seem as if they're "real".

arguments:

isMobile
(int) 1 if mobile, 0 if immobile.
  setMoveProbability 
setMoveProbability ( self,  heartbeatInterval )

Sets the move probability.

arguments:

heartbeatInterval
(int) ???
  setRandomActions 
setRandomActions ( self,  actions )

Sets the list of random actions all at once.

arguments:

actions
(list of strings) the list of actions to set
  setRandomChats 
setRandomChats ( self,  messages )

Sets the chats this NPC says.

arguments:

messages
(list of strings) the things this NPC says
  write 
write ( self,  *message )

Handles data going from the mud to this NPC.

This data is pretty raw and hard to parse. But if you want it, override this method.

arguments:

*message
(list of strings adn VBFCs)

Table of Contents

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