<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: char</title>
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>char</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br>(built-in)</font></td></tr></table>
<p><tt>Contains the Python wrapper for characters, and utilities for searching,<br>
storing, and generating NPCs from mob prototypes.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="char.html#Char">Char</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="Char">class <strong>Char</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt><a href="#Char">Char</a>/Mob objects<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Char-__cmp__"><strong>__cmp__</strong></a>(...)</dt><dd><tt>x.<a href="#Char-__cmp__">__cmp__</a>(y) <==> cmp(x,y)</tt></dd></dl>
<dl><dt><a name="Char-__hash__"><strong>__hash__</strong></a>(...)</dt><dd><tt>x.<a href="#Char-__hash__">__hash__</a>() <==> hash(x)</tt></dd></dl>
<dl><dt><a name="Char-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#Char-__init__">__init__</a>(...) initializes x; see x.__class__.__doc__ for signature</tt></dd></dl>
<dl><dt><a name="Char-act"><strong>act</strong></a>(...)</dt><dd><tt><a href="#Char-act">act</a>(command)<br>
<br>
Simulate a character typing in a command.</tt></dd></dl>
<dl><dt><a name="Char-append_look"><strong>append_look</strong></a>(...)</dt><dd><tt><a href="#Char-append_look">append_look</a>(text)<br>
<br>
Adds text to the character's current look buffer.</tt></dd></dl>
<dl><dt><a name="Char-attach"><strong>attach</strong></a>(...)</dt><dd><tt><a href="#Char-attach">attach</a>(trigger)<br>
<br>
Attach a trigger to the character by key name.</tt></dd></dl>
<dl><dt><a name="Char-aux"><strong>aux</strong></a>(...)</dt><dd><tt>Alias for char.<a href="#Char">Char</a>.<a href="#Char-getAuxiliary">getAuxiliary</a>(name)</tt></dd></dl>
<dl><dt><a name="Char-cansee"><strong>cansee</strong></a>(...)</dt><dd><tt><a href="#Char-cansee">cansee</a>(thing)<br>
<br>
Returns whether a character can see the specified <a href="__builtin__.html#object">object</a>, exit, or other<br>
character.</tt></dd></dl>
<dl><dt><a name="Char-clear_look"><strong>clear_look</strong></a>(...)</dt><dd><tt><a href="#Char-clear_look">clear_look</a>()<br>
<br>
Clear the character's current look buffer.</tt></dd></dl>
<dl><dt><a name="Char-copy"><strong>copy</strong></a>(...)</dt><dd><tt><a href="#Char-copy">copy</a>()<br>
<br>
Returns a copy of the character.</tt></dd></dl>
<dl><dt><a name="Char-deletevar"><strong>deletevar</strong></a>(...)</dt><dd><tt><a href="#Char-deletevar">deletevar</a>(name)<br>
<br>
Deletes a special variable from a character if they have one by the<br>
given name.</tt></dd></dl>
<dl><dt><a name="Char-delvar"><strong>delvar</strong></a>(...)</dt><dd><tt>Alias for char.<a href="#Char">Char</a>.<a href="#Char-deletevar">deletevar</a>(name)</tt></dd></dl>
<dl><dt><a name="Char-detach"><strong>detach</strong></a>(...)</dt><dd><tt><a href="#Char-detach">detach</a>(trigger)<br>
<br>
Detach a trigger from the character by key name.</tt></dd></dl>
<dl><dt><a name="Char-do_trigs"><strong>do_trigs</strong></a>(...)</dt><dd><tt><a href="#Char-do_trigs">do_trigs</a>(type, ch=None, obj=None, room=None, exit=None, cmd=None,<br>
arg=None, opts=None)<br>
<br>
Run triggers of the specified type on the character. By default, the<br>
trigger owner is 'me'. Other variables can be specified. The opts<br>
variable can be a dictionary that maps optional variable names to their<br>
values.</tt></dd></dl>
<dl><dt><a name="Char-equip"><strong>equip</strong></a>(...)</dt><dd><tt><a href="#Char-equip">equip</a>(obj, positions=None, forced=False)<br>
<br>
Attempts to equip an <a href="__builtin__.html#object">object</a> to the character's body. Positions can be a<br>
comma-separated list of position names or position types. If positions<br>
is None and <a href="__builtin__.html#object">object</a> is of type 'worn', attempt to equip the <a href="__builtin__.html#object">object</a> to<br>
its default positions. Setting forced to True allows non-worn objects<br>
to be equipped, or worn objects to be equipped to their non-default<br>
positions. Returns success of attempt.</tt></dd></dl>
<dl><dt><a name="Char-getAuxiliary"><strong>getAuxiliary</strong></a>(...)</dt><dd><tt><a href="#Char-getAuxiliary">getAuxiliary</a>(name)<br>
<br>
Returns character's auxiliary data of the specified name.</tt></dd></dl>
<dl><dt><a name="Char-get_alias"><strong>get_alias</strong></a>(...)</dt><dd><tt><a href="#Char-get_alias">get_alias</a>(name)<br>
<br>
Return character's alias by the specified name, or None.</tt></dd></dl>
<dl><dt><a name="Char-get_bodypct"><strong>get_bodypct</strong></a>(...)</dt><dd><tt><a href="#Char-get_bodypct">get_bodypct</a>(posnames)<br>
<br>
Returns the percent mass of the character's body taken up by the<br>
specified parts. Bodyparts must be a comma-separated list.</tt></dd></dl>
<dl><dt><a name="Char-get_equip"><strong>get_equip</strong></a>(...)</dt><dd><tt><a href="#Char-get_equip">get_equip</a>(bodypart)<br>
<br>
Returns <a href="__builtin__.html#object">object</a> currently equipped to the character's bodypart, or None.</tt></dd></dl>
<dl><dt><a name="Char-get_slot_types"><strong>get_slot_types</strong></a>(...)</dt><dd><tt><a href="#Char-get_slot_types">get_slot_types</a>(obj)<br>
<br>
Returns a list of the bodypart types currently occupied by the <a href="__builtin__.html#object">object</a>.<br>
Returns an empty list of the <a href="__builtin__.html#object">object</a> is not equipped to this character.</tt></dd></dl>
<dl><dt><a name="Char-get_slots"><strong>get_slots</strong></a>(...)</dt><dd><tt><a href="#Char-get_slots">get_slots</a>(obj)<br>
<br>
Returns a comma-separated list of bodypart names currently occupied by<br>
the <a href="__builtin__.html#object">object</a>.</tt></dd></dl>
<dl><dt><a name="Char-getvar"><strong>getvar</strong></a>(...)</dt><dd><tt><a href="#Char-getvar">getvar</a>(name)<br>
<br>
Return value of a special variable. Return 0 if no value has been set.</tt></dd></dl>
<dl><dt><a name="Char-hasPrefs"><strong>hasPrefs</strong></a>(...)</dt><dd><tt><a href="#Char-hasPrefs">hasPrefs</a>(char_prefs)<br>
<br>
Return whether character has any of the specified character preferences.<br>
Multiples can be specified as a comma-separated string.</tt></dd></dl>
<dl><dt><a name="Char-hasvar"><strong>hasvar</strong></a>(...)</dt><dd><tt><a href="#Char-hasvar">hasvar</a>(name)<br>
<br>
Return True if a character has the given special variable. False otherwise.</tt></dd></dl>
<dl><dt><a name="Char-interrupt"><strong>interrupt</strong></a>(...)</dt><dd><tt><a href="#Char-interrupt">interrupt</a>()<br>
<br>
Cancel any action the character is currently taking.</tt></dd></dl>
<dl><dt><a name="Char-isActing"><strong>isActing</strong></a>(...)</dt><dd><tt><a href="#Char-isActing">isActing</a>()<br>
<br>
Returns True if the character is currently taking an action, and False<br>
otherwise.</tt></dd></dl>
<dl><dt><a name="Char-isInGroup"><strong>isInGroup</strong></a>(...)</dt><dd><tt><a href="#Char-isInGroup">isInGroup</a>(usergroup)<br>
<br>
Returns whether a character belongs to a specified user group.</tt></dd></dl>
<dl><dt><a name="Char-isinstance"><strong>isinstance</strong></a>(...)</dt><dd><tt><a href="#Char-isinstance">isinstance</a>(prototype)<br>
<br>
returns whether the character inherits from a specified mob prototype.</tt></dd></dl>
<dl><dt><a name="Char-page"><strong>page</strong></a>(...)</dt><dd><tt><a href="#Char-page">page</a>(text)<br>
<br>
Send text to the character in paginated form e.g., for helpfiles and<br>
.other large blocks of text.</tt></dd></dl>
<dl><dt><a name="Char-see_as"><strong>see_as</strong></a>(...)</dt><dd><tt><a href="#Char-see_as">see_as</a>(thing)<br>
<br>
Returns the name by which a character sees a specified <a href="__builtin__.html#object">object</a>, exit, or<br>
other character.</tt></dd></dl>
<dl><dt><a name="Char-send"><strong>send</strong></a>(...)</dt><dd><tt><a href="#Char-send">send</a>(mssg, dict = None, newline = True)<br>
<br>
Sends message to the character. Messages can have scripts embedded in<br>
them, using [ and ]. If so, a variable dictionary must be provided. By<br>
default, 'me' references the character being sent the message.</tt></dd></dl>
<dl><dt><a name="Char-send_raw"><strong>send_raw</strong></a>(...)</dt><dd><tt><a href="#Char-send_raw">send_raw</a>(mssg)<br>
<br>
Sends message to the character with no newline appended.</tt></dd></dl>
<dl><dt><a name="Char-sendaround"><strong>sendaround</strong></a>(...)</dt><dd><tt><a href="#Char-sendaround">sendaround</a>(mssg, dict = None, cansee_only = False, newline=True)<br>
<br>
Sends a message to everyone in the character's room. Messages can have<br>
scripts embedded in them using [ and ]. If so, a variable dictionary<br>
must be provided. By default, 'me' references the person sendaround is<br>
called on, and 'ch' references each character being sent a message.</tt></dd></dl>
<dl><dt><a name="Char-set_alias"><strong>set_alias</strong></a>(...)</dt><dd><tt><a href="#Char-set_alias">set_alias</a>(name, value)<br>
<br>
Set a character's alias. Value must be a string.</tt></dd></dl>
<dl><dt><a name="Char-set_routine"><strong>set_routine</strong></a>(ch, routine, repeat<font color="#909090">=False</font>, checks<font color="#909090">=None</font>)</dt><dd><tt>Sets a routine to a character. Routine steps can constain commands<br>
(character strings), functions (one argument, ch), or tuples<br>
(delay, string | function). If a tuple is not supplied, the default<br>
step time is used</tt></dd></dl>
<dl><dt><a name="Char-setvar"><strong>setvar</strong></a>(...)</dt><dd><tt><a href="#Char-setvar">setvar</a>(name, val)<br>
<br>
Set value of a special variable for the character. Values must be<br>
strings or numbers. This function is intended to allow scripts and<br>
triggers to open-endedly add variables to characters.</tt></dd></dl>
<dl><dt><a name="Char-startAction"><strong>startAction</strong></a>(...)</dt><dd><tt><a href="#Char-startAction">startAction</a>(delay, on_complete, on_interrupt=None, data=None, arg='')<br>
<br>
Begins a new delayed action for the character. Delay is in seconds.<br>
on_complete is a function taking three arguments: the character, the<br>
data, and the argument. Argument must be a string, data can be anything.<br>
on_interrupt takes the same arguments as on_complete, but is instead<br>
called if the character's action is interrupted.</tt></dd></dl>
<dl><dt><a name="Char-store"><strong>store</strong></a>(...)</dt><dd><tt><a href="#Char-store">store</a>()<br>
<br>
Return a storage set representing the character.</tt></dd></dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>__new__</strong> = <built-in method __new__ of type object><dd><tt>T.<a href="#Char-__new__">__new__</a>(S, ...) -> a new <a href="__builtin__.html#object">object</a> with type S, a subtype of T</tt></dl>
<dl><dt><strong>age</strong> = <attribute 'age' of 'char.Char' objects><dd><tt>Value is the difference between the character's creation time and the<br>
current system time. Immutable.</tt></dl>
<dl><dt><strong>aliases</strong> = <attribute 'aliases' of 'char.Char' objects><dd><tt>A list of all aliases the character currently has defined. Immutable.</tt></dl>
<dl><dt><strong>birth</strong> = <attribute 'birth' of 'char.Char' objects><dd><tt>Value is the character's creation time (system time). Immutable.</tt></dl>
<dl><dt><strong>bodyparts</strong> = <attribute 'bodyparts' of 'char.Char' objects><dd><tt>An immutable list naming all of the character's bodyparts.</tt></dl>
<dl><dt><strong>desc</strong> = <attribute 'desc' of 'char.Char' objects><dd><tt>A character's verbose description for e.g., when they are looked at.</tt></dl>
<dl><dt><strong>eq</strong> = <attribute 'eq' of 'char.Char' objects><dd><tt>An immutable list of the character's worn equipment.<br>
See <a href="#Char-equip">equip</a>() and unequip() for altering a characters worn items.</tt></dl>
<dl><dt><strong>gender</strong> = <attribute 'gender' of 'char.Char' objects><dd><tt>Alias for char.<a href="#Char">Char</a>.sex</tt></dl>
<dl><dt><strong>heshe</strong> = <attribute 'heshe' of 'char.Char' objects><dd><tt>Value is 'he', 'she', or 'it'. Immutable.</tt></dl>
<dl><dt><strong>hidden</strong> = <attribute 'hidden' of 'char.Char' objects><dd><tt>Integer value representing how hidden the character is. Default is 0.</tt></dl>
<dl><dt><strong>himher</strong> = <attribute 'himher' of 'char.Char' objects><dd><tt>Value is 'him', 'her', or 'it'. Immutable.</tt></dl>
<dl><dt><strong>hisher</strong> = <attribute 'hisher' of 'char.Char' objects><dd><tt>Value is 'his', 'her', or 'its'. Immutable.</tt></dl>
<dl><dt><strong>inv</strong> = <attribute 'inv' of 'char.Char' objects><dd><tt>An immutable list of objects in the character's inventory.<br>
See obj.Obj.carrier for altering an item's carrier.</tt></dl>
<dl><dt><strong>is_npc</strong> = <attribute 'is_npc' of 'char.Char' objects><dd><tt>Value is True if character is an NPC, and False otherwise. Immutable.</tt></dl>
<dl><dt><strong>is_pc</strong> = <attribute 'is_pc' of 'char.Char' objects><dd><tt>Value is negation of char.<a href="#Char">Char</a>.is_npc</tt></dl>
<dl><dt><strong>keywords</strong> = <attribute 'keywords' of 'char.Char' objects><dd><tt>A comma-separated list of the keywords for referencing the character.</tt></dl>
<dl><dt><strong>last_room</strong> = <attribute 'last_room' of 'char.Char' objects><dd><tt>The last room a character was in. Immutable. Value is None if character<br>
was not previously in a room.</tt></dl>
<dl><dt><strong>look_buf</strong> = <attribute 'look_buf' of 'char.Char' objects><dd><tt>When characters look at something, the thing's description is copied to<br>
the character's look buffer for processing before being sent.</tt></dl>
<dl><dt><strong>mdesc</strong> = <attribute 'mdesc' of 'char.Char' objects><dd><tt>The equivalent of mname, for room descriptions.</tt></dl>
<dl><dt><strong>mname</strong> = <attribute 'mname' of 'char.Char' objects><dd><tt>The character's name for describing packs, e.g.,<br>
a horde of 9001 mosquitos. The number should be replaced by %d, or not<br>
included.</tt></dl>
<dl><dt><strong>mob_class</strong> = <attribute 'mob_class' of 'char.Char' objects><dd><tt>The main prototype the mobile inherits from. Immutable.</tt></dl>
<dl><dt><strong>name</strong> = <attribute 'name' of 'char.Char' objects><dd><tt>The characer's name, e.g., Grunald the Baker.</tt></dl>
<dl><dt><strong>notepad</strong> = <attribute 'notepad' of 'char.Char' objects><dd><tt>Returns the character's notepad, if any</tt></dl>
<dl><dt><strong>objs</strong> = <attribute 'objs' of 'char.Char' objects><dd><tt>An alias for inv to be consistent with how room and <a href="__builtin__.html#object">object</a> contents are<br>
accessed.</tt></dl>
<dl><dt><strong>on</strong> = <attribute 'on' of 'char.Char' objects><dd><tt>The furniture the character is sitting on/at. Value is None if character<br>
is not currently on furniture. Set value to None to remove a character<br>
from their furniture.</tt></dl>
<dl><dt><strong>pos</strong> = <attribute 'pos' of 'char.Char' objects><dd><tt>Alias for char.<a href="#Char">Char</a>.position.</tt></dl>
<dl><dt><strong>position</strong> = <attribute 'position' of 'char.Char' objects><dd><tt>The character's current position (e.g., standing, sleeping, sitting).</tt></dl>
<dl><dt><strong>prototypes</strong> = <attribute 'prototypes' of 'char.Char' objects><dd><tt>A comma-separated list of prototypes the mobile inherits from. Immutable.</tt></dl>
<dl><dt><strong>race</strong> = <attribute 'race' of 'char.Char' objects><dd><tt>The character's race.</tt></dl>
<dl><dt><strong>rdesc</strong> = <attribute 'rdesc' of 'char.Char' objects><dd><tt>The character's description when seen in a room, e.g., <br>
Bob is here, baking a cake.</tt></dl>
<dl><dt><strong>room</strong> = <attribute 'room' of 'char.Char' objects><dd><tt>The current room a character is in. Can be set by room or room key.</tt></dl>
<dl><dt><strong>sex</strong> = <attribute 'sex' of 'char.Char' objects><dd><tt>The character's sex. Can be male, female, or neutral.</tt></dl>
<dl><dt><strong>sock</strong> = <attribute 'sock' of 'char.Char' objects><dd><tt>Alias for char.<a href="#Char">Char</a>.socket</tt></dl>
<dl><dt><strong>socket</strong> = <attribute 'socket' of 'char.Char' objects><dd><tt>The current socket this character is attached to. Value is None if <br>
socket does not exist. Immutable. Use mudsys.attach_char_socket to <br>
attach a character and socket to each other.</tt></dl>
<dl><dt><strong>uid</strong> = <attribute 'uid' of 'char.Char' objects><dd><tt>The character's unique identification number. Immutable.</tt></dl>
<dl><dt><strong>user_groups</strong> = <attribute 'user_groups' of 'char.Char' objects><dd><tt>A comma-separated list of user groups the character belongs to.<br>
Use char.<a href="#Char">Char</a>.<a href="#Char-isInGroup">isInGroup</a>(group) to check for a specific group. Immutable.</tt></dl>
<dl><dt><strong>weight</strong> = <attribute 'weight' of 'char.Char' objects><dd><tt>Floating point value representing how heavy the character is.</tt></dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt><a name="-char_list"><strong>char_list</strong></a>(...)</dt><dd><tt><a href="#-char_list">char_list</a>()<br>
<br>
Return a list of every character in game.</tt></dd></dl>
<dl><dt><a name="-count_mobs"><strong>count_mobs</strong></a>(...)</dt><dd><tt><a href="#-count_mobs">count_mobs</a>(keyword, loc = None)<br>
<br>
count how many occurences of a mobile with the specified keyword, uid,<br>
or prototype exist at a location. If loc is None, search the entire mud.<br>
Loc can be a room, room prototype, or furniture <a href="__builtin__.html#object">object</a>.</tt></dd></dl>
<dl><dt><a name="-find_char_key"><strong>find_char_key</strong></a>(...)</dt><dd><tt>Function has been deprecated. Entrypoint for generic_find()<br>
Use mud.parse_args instead.</tt></dd></dl>
<dl><dt><a name="-is_abstract"><strong>is_abstract</strong></a>(...)</dt><dd><tt><a href="#-is_abstract">is_abstract</a>(proto)<br>
<br>
Returns whether a specified mob prototype is abstract. Also return True<br>
if the prototype does not exist.</tt></dd></dl>
<dl><dt><a name="-load_mob"><strong>load_mob</strong></a>(...)</dt><dd><tt><a href="#-load_mob">load_mob</a>(proto, room, pos = 'standing')<br>
<br>
Generate a new mobile from the specified prototype. Add it to the<br>
given room. Return the created mobile.</tt></dd></dl>
<dl><dt><a name="-read"><strong>read</strong></a>(...)</dt><dd><tt><a href="#-read">read</a>(storage_set)<br>
<br>
Read and return a character from a storage set.</tt></dd></dl>
</td></tr></table>
</body></html>