Class: DpLiving
SOURCE LOCATION: /dpuniverse/std/DpLiving.php
Class Overview
|
An object which is "alive", common code shared between users and NPCs
Creates the following DutchPIPE properties:
- boolean isLiving - Set to TRUE
- string displayMode - "graphical" or "abstract"
- integer sessionAge - Age in seconds of this object
- integer weightCarry - Combined weight of objects in our inventory
- integer maxWeightCarry - Maximum weight this object can carry
- integer volumeCarry - Combined volume of objects in our inventory
- integer maxVolumeCarry - Maximum volume this object can carry
- string actionFailure - Last action error message, "Read what?"
- string actionDefaultFailure - Default action error message, "What?"
- int lastActionTime - UNIX time stamp of last action performed
- string inputMode - Input area mode, 'say' or 'cmd'
DpProperties
|
--DpObject
|
--DpLiving
|
METHODS:
|
Direct Descendants
| DpUser |
A user object, the object representing a real user
|
| DpNpc |
A 'non playing character', a bot
|
Methods Summary
| boolean |
actionCheer() |
Makes this living object cheer wildly |
| boolean |
actionDance() |
Makes this living object take another living object for a dance |
| boolean |
actionDrop() |
Drops an object in the user's environment |
| boolean |
actionEmote() |
Makes this living object communicate a custom message to its environment |
| boolean |
actionExamine() |
Makes this living object examine an object |
| boolean |
actionGive() |
Makes this living object give an object to another living object |
| boolean |
actionGrin() |
Makes this living object grin evilly |
| boolean |
actionHighFive() |
Makes this living object slap a high-five with another living object |
| boolean |
actionHug() |
Makes this living object hug another living object |
| boolean |
actionInventory() |
Shows this living object a list of objects it is carrying |
| boolean |
actionKiss() |
Makes this living object give another living object a passionate kiss |
| boolean |
actionLaugh() |
Makes this living object fall down on the floor laughing |
| boolean |
actionNod() |
Makes this living object nod solemnly |
| boolean |
actionPat() |
Makes this living object pat another living object on the head |
| boolean |
actionSay() |
Makes this living object say something |
| boolean |
actionShout() |
Makes this living object shout something to everyone on the site |
| boolean |
actionSmile() |
Makes this living object smile happily |
| boolean |
actionTake() |
Makes this living object take an object |
| boolean |
actionTell() |
Makes this living object tell something to another user object |
| void |
createDpLiving() |
Sets this living object up at the time it is created |
| string |
getSessionAge() |
Gets the livings's age since it was created as an object in a string |
| boolean |
performAction() |
Tries to perform the action given by the living object |
Methods
boolean actionCheer(
string
$verb , string
$noun
)
Makes this living object cheer wildly
| PARAMETERS: |
string |
$verb |
the action, "cheer" |
| string |
$noun |
who to cheer on, could be empty |
| RETURNS: | boolean | TRUE |
boolean actionDance(
string
$verb , string
$noun
)
Makes this living object take another living object for a dance
| PARAMETERS: |
string |
$verb |
the action, "dance" |
| string |
$noun |
who to dance with, could be empty |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
boolean actionDrop(
string
$verb , string
$noun , [
$silently = FALSE]
)
Drops an object in the user's environment
| PARAMETERS: |
string |
$verb |
the action, "drop" |
| string |
$noun |
what to drop, could be empty |
| |
$silently |
|
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
boolean actionEmote(
string
$verb , string
$noun
)
Makes this living object communicate a custom message to its environment
| PARAMETERS: |
string |
$verb |
the action, "emote" |
| string |
$noun |
string to "emote" |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
| REDEFINED AS: |
DpUser::actionEmote(): Makes this user communicate a custom message to its environment
|
boolean actionExamine(
string
$verb , string
$noun
)
Makes this living object examine an object
| PARAMETERS: |
string |
$verb |
the action, "examine" |
| string |
$noun |
what to examine, could be empty |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
boolean actionGive(
string
$verb , string
$noun
)
Makes this living object give an object to another living object
| PARAMETERS: |
string |
$verb |
the action, "give" |
| string |
$noun |
what and who to give, could be empty |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
| SEE: | actionGiveOperant() |
boolean actionGrin(
string
$verb , string
$noun
)
Makes this living object grin evilly
| PARAMETERS: |
string |
$verb |
the action, "grin" |
| string |
$noun |
empty string |
| RETURNS: | boolean | TRUE |
actionHighFive [line 1015]
boolean actionHighFive(
string
$verb , string
$noun
)
Makes this living object slap a high-five with another living object
| PARAMETERS: |
string |
$verb |
the action, "high5" |
| string |
$noun |
who to high5, could be empty |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
boolean actionHug(
string
$verb , string
$noun
)
Makes this living object hug another living object
| PARAMETERS: |
string |
$verb |
the action, "hug" |
| string |
$noun |
who to hug, could be empty |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
actionInventory [line 600]
boolean actionInventory(
string
$verb , string
$noun
)
Shows this living object a list of objects it is carrying
| PARAMETERS: |
string |
$verb |
the action, "inventory" |
| string |
$noun |
empty string |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
boolean actionKiss(
string
$verb , string
$noun
)
Makes this living object give another living object a passionate kiss
| PARAMETERS: |
string |
$verb |
the action, "kiss" |
| string |
$noun |
who to kiss, could be empty |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
boolean actionLaugh(
string
$verb , string
$noun
)
Makes this living object fall down on the floor laughing
| PARAMETERS: |
string |
$verb |
the action, "laugh" |
| string |
$noun |
empty string |
| RETURNS: | boolean | TRUE |
boolean actionNod(
string
$verb , string
$noun
)
Makes this living object nod solemnly
| PARAMETERS: |
string |
$verb |
the action, "nod" |
| string |
$noun |
empty string |
| RETURNS: | boolean | TRUE |
boolean actionPat(
string
$verb , string
$noun
)
Makes this living object pat another living object on the head
| PARAMETERS: |
string |
$verb |
the action, "pat" |
| string |
$noun |
who to pat, could be empty |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
boolean actionSay(
string
$verb , string
$noun
)
Makes this living object say something
| PARAMETERS: |
string |
$verb |
the action, "say" |
| string |
$noun |
what to say, could be empty |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
boolean actionShout(
string
$verb , string
$noun
)
Makes this living object shout something to everyone on the site
| PARAMETERS: |
string |
$verb |
the action, "shout" |
| string |
$noun |
what to shout, could be empty |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
| REDEFINED AS: |
DpUser::actionShout(): Makes this user shout something to everyone on the site
|
boolean actionShrug(
string
$verb , string
$noun
)
Makes this living object shrug
| PARAMETERS: |
string |
$verb |
the action, "laugh" |
| string |
$noun |
empty string |
| RETURNS: | boolean | TRUE |
boolean actionSmile(
string
$verb , string
$noun
)
Makes this living object smile happily
| PARAMETERS: |
string |
$verb |
the action, "smile" |
| string |
$noun |
empty string |
| RETURNS: | boolean | TRUE |
boolean actionTake(
string
$verb , string
$noun
)
Makes this living object take an object
| PARAMETERS: |
string |
$verb |
the action, "take" |
| string |
$noun |
what to take, could be empty |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
boolean actionTell(
string
$verb , string
$noun
)
Makes this living object tell something to another user object
| PARAMETERS: |
string |
$verb |
the action, "tell" |
| string |
$noun |
who and what to tell, could be empty |
| RETURNS: | boolean | TRUE for action completed, FALSE otherwise |
| REDEFINED AS: |
DpUser::actionTell(): Makes this user object tell something to another user object
|
createDpLiving [line 213]
void createDpLiving(
)
Sets this living object up at the time it is created
An empty function which can be redefined by the living class extending on DpLiving. When the object is created, it has no title, HTML body, et cetera, so in this method methods like DpObject::setTitle() are called. Building blocks extending on DpLiving may define their own create function. For example, DpNpc defines DpNpc:createDpNpc.
void eventDpLiving(
object
$name , mixed
$args
)
Reports an event
Called when certain events occur, given with $name.
void eventDpObject(
object
$name , mixed
$args
)
Reports an event
Called when certain events occur, given with $name. Calls the method 'eventDpLiving' in this living object.
| PARAMETERS: |
object |
$name |
Name of event |
| mixed |
$args |
One or more arguments, depends on event |
| SINCE: | DutchPIPE 0.2.0 |
| REDEFINITION OF: |
DpObject::eventDpObject(): Reports an event |
getActionOperantMenu [line 659]
string getActionOperantMenu(
string
$verb ,
&$menuobj
)
Completes the give action performed by clicking on an object
Called by the action system when someone clicks on an object and selects "give...". Returns something like "beer to", which allows the system to fill the input area with "give beer to " using the title of the object which was clicked on.
| PARAMETERS: |
string |
$verb |
the action, "give" |
| |
&$menuobj |
|
| RETURNS: | string | a string such as "beer to " |
| SEE: | DpLiving::actionGive() |
getEmotionsMenu [line 634]
void getEmotionsMenu(
$verb ,
&$defined_by ,
&$target ,
&$performer
)
| PARAMETERS: |
|
$verb |
|
| |
&$defined_by |
|
| |
&$target |
|
| |
&$performer |
|
getMenuGiveAuth [line 694]
void getMenuGiveAuth(
)
getMenuGiveLabel [line 717]
void getMenuGiveLabel(
)
getMenuTellAuth [line 708]
void getMenuTellAuth(
)
string getSessionAge(
)
Gets the livings's age since it was created as an object in a string
Returns the livings's age in a format like "6 hours and 14 minutes".
getTellOperant [line 642]
void getTellOperant(
$verb ,
&$defined_by ,
&$target ,
&$performer
)
| PARAMETERS: |
|
$verb |
|
| |
&$defined_by |
|
| |
&$target |
|
| |
&$performer |
|
getVolumeCarry [line 366]
void getVolumeCarry(
)
getWeightCarry [line 352]
void getWeightCarry(
)
boolean performAction(
string
$action
)
Tries to perform the action given by the living object
Called by the system to handle both actions performed by clicking on menus and actions from the input area. The first method will result in an $action parameter such as "take object_242" (using an unique object id). With the second method, $action will contain what the user typed, such as "take beer". Searches and calls for the right method linked to the action, which could be in another object. Handles failure messages when the action failed. This method can also be used to force living objects to perform actions.
void resetDpLiving(
)
Resets this living object
Called by this living object at regular intervals as defined in dpuniverse-ini.php. An empty function which can be redefined by the living class extending on DpLiving. To be used to periodically do stuff such as alter the state of the living object.
timeoutHeartBeat [line 282]
void timeoutHeartBeat(
)
Calls itself every "heartbeat"
Redefine this method to make timed stuff happen.
|
|