room.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html><head><title>Python: room</title>
  3. </head><body bgcolor="#f0f0f8">
  4. <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
  5. <tr bgcolor="#7799ee">
  6. <td valign=bottom>&nbsp;<br>
  7. <font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>room</strong></big></big></font></td
  8. ><td align=right valign=bottom
  9. ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br>(built-in)</font></td></tr></table>
  10. <p><tt>Contains&nbsp;the&nbsp;Python&nbsp;wrapper&nbsp;for&nbsp;rooms,&nbsp;and&nbsp;utilities&nbsp;for&nbsp;loading&nbsp;and<br>
  11. instancing&nbsp;rooms.</tt></p>
  12. <p>
  13. <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
  14. <tr bgcolor="#ee77aa">
  15. <td colspan=3 valign=bottom>&nbsp;<br>
  16. <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
  17. <tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
  18. <td width="100%"><dl>
  19. <dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
  20. </font></dt><dd>
  21. <dl>
  22. <dt><font face="helvetica, arial"><a href="room.html#Room">Room</a>
  23. </font></dt></dl>
  24. </dd>
  25. </dl>
  26. <p>
  27. <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
  28. <tr bgcolor="#ffc8d8">
  29. <td colspan=3 valign=bottom>&nbsp;<br>
  30. <font color="#000000" face="helvetica, arial"><a name="Room">class <strong>Room</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
  31. <tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
  32. <td colspan=2><tt><a href="#Room-__init__">__init__</a>(self,&nbsp;uid_or_string_key)<br>
  33. &nbsp;<br>
  34. Creates&nbsp;a&nbsp;new&nbsp;Python&nbsp;reference&nbsp;to&nbsp;a&nbsp;room,&nbsp;by&nbsp;uid.&nbsp;If&nbsp;a&nbsp;string&nbsp;database<br>
  35. key&nbsp;is&nbsp;instead&nbsp;supplied,&nbsp;first&nbsp;try&nbsp;to&nbsp;generate&nbsp;a&nbsp;room&nbsp;by&nbsp;an&nbsp;rporoto&nbsp;of<br>
  36. the&nbsp;same&nbsp;name.&nbsp;If&nbsp;no&nbsp;rproto&nbsp;exists,&nbsp;create&nbsp;a&nbsp;new&nbsp;blank&nbsp;room&nbsp;in&nbsp;the&nbsp;room<br>
  37. table,&nbsp;and&nbsp;assign&nbsp;it&nbsp;the&nbsp;given&nbsp;key.<br>&nbsp;</tt></td></tr>
  38. <tr><td>&nbsp;</td>
  39. <td width="100%">Methods defined here:<br>
  40. <dl><dt><a name="Room-__cmp__"><strong>__cmp__</strong></a>(...)</dt><dd><tt>x.<a href="#Room-__cmp__">__cmp__</a>(y)&nbsp;&lt;==&gt;&nbsp;cmp(x,y)</tt></dd></dl>
  41. <dl><dt><a name="Room-__hash__"><strong>__hash__</strong></a>(...)</dt><dd><tt>x.<a href="#Room-__hash__">__hash__</a>()&nbsp;&lt;==&gt;&nbsp;hash(x)</tt></dd></dl>
  42. <dl><dt><a name="Room-__init__"><strong>__init__</strong></a>(...)</dt><dd><tt>x.<a href="#Room-__init__">__init__</a>(...)&nbsp;initializes&nbsp;x;&nbsp;see&nbsp;x.__class__.__doc__&nbsp;for&nbsp;signature</tt></dd></dl>
  43. <dl><dt><a name="Room-add_cmd"><strong>add_cmd</strong></a>(...)</dt><dd><tt><a href="#Room-add_cmd">add_cmd</a>(name,&nbsp;shorthand,&nbsp;cmd_func,&nbsp;user_group,&nbsp;interrupts&nbsp;=&nbsp;False)<br>
  44. &nbsp;<br>
  45. Add&nbsp;a&nbsp;new&nbsp;player&nbsp;command&nbsp;specific&nbsp;to&nbsp;the&nbsp;room.&nbsp;See&nbsp;mudsys.add_cmd&nbsp;for<br>
  46. documentation&nbsp;on&nbsp;commands.</tt></dd></dl>
  47. <dl><dt><a name="Room-add_cmd_check"><strong>add_cmd_check</strong></a>(...)</dt><dd><tt><a href="#Room-add_cmd_check">add_cmd_check</a>(cmd_name,&nbsp;check_func)<br>
  48. &nbsp;<br>
  49. Add&nbsp;a&nbsp;new&nbsp;command&nbsp;check&nbsp;function&nbsp;specific&nbsp;to&nbsp;the&nbsp;room.&nbsp;See&nbsp;<br>
  50. mudsys.add_cmd_check&nbsp;for&nbsp;documentation&nbsp;on&nbsp;command&nbsp;checks.</tt></dd></dl>
  51. <dl><dt><a name="Room-attach"><strong>attach</strong></a>(...)</dt><dd><tt><a href="#Room-attach">attach</a>(trigger)<br>
  52. &nbsp;<br>
  53. Attach&nbsp;a&nbsp;trigger&nbsp;to&nbsp;the&nbsp;room&nbsp;by&nbsp;key&nbsp;name.</tt></dd></dl>
  54. <dl><dt><a name="Room-aux"><strong>aux</strong></a>(...)</dt><dd><tt>Alias&nbsp;for&nbsp;room.<a href="#Room">Room</a>.<a href="#Room-getAuxiliary">getAuxiliary</a>(name)</tt></dd></dl>
  55. <dl><dt><a name="Room-deletevar"><strong>deletevar</strong></a>(...)</dt><dd><tt><a href="#Room-deletevar">deletevar</a>(name)<br>
  56. &nbsp;<br>
  57. Deletes&nbsp;a&nbsp;special&nbsp;variable&nbsp;from&nbsp;a&nbsp;room&nbsp;if&nbsp;they&nbsp;have&nbsp;one&nbsp;by&nbsp;the<br>
  58. given&nbsp;name.</tt></dd></dl>
  59. <dl><dt><a name="Room-delvar"><strong>delvar</strong></a>(...)</dt><dd><tt>Alias&nbsp;for&nbsp;room.<a href="#Room">Room</a>.<a href="#Room-deletevar">deletevar</a>(name)</tt></dd></dl>
  60. <dl><dt><a name="Room-detach"><strong>detach</strong></a>(...)</dt><dd><tt><a href="#Room-detach">detach</a>(trigger)<br>
  61. &nbsp;<br>
  62. Detach&nbsp;a&nbsp;trigger&nbsp;from&nbsp;the&nbsp;room&nbsp;by&nbsp;key&nbsp;name.</tt></dd></dl>
  63. <dl><dt><a name="Room-dig"><strong>dig</strong></a>(...)</dt><dd><tt><a href="#Room-dig">dig</a>(dir,&nbsp;dest)<br>
  64. &nbsp;<br>
  65. Link&nbsp;the&nbsp;room&nbsp;to&nbsp;another&nbsp;room&nbsp;via&nbsp;the&nbsp;specified&nbsp;direction.&nbsp;The<br>
  66. destination&nbsp;room&nbsp;can&nbsp;be&nbsp;an&nbsp;actual&nbsp;room&nbsp;or&nbsp;a&nbsp;room&nbsp;key&nbsp;name.&nbsp;Returns<br>
  67. the&nbsp;created&nbsp;exit.&nbsp;If&nbsp;an&nbsp;exit&nbsp;already&nbsp;exists&nbsp;in&nbsp;the&nbsp;specified<br>
  68. direction,&nbsp;change&nbsp;its&nbsp;destination.</tt></dd></dl>
  69. <dl><dt><a name="Room-do_trigs"><strong>do_trigs</strong></a>(...)</dt><dd><tt><a href="#Room-do_trigs">do_trigs</a>(type,&nbsp;ch=None,&nbsp;obj=None,&nbsp;room=None,&nbsp;exit=None,&nbsp;cmd=None,<br>
  70. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;arg=None,&nbsp;opts=None)<br>
  71. &nbsp;<br>
  72. Run&nbsp;triggers&nbsp;of&nbsp;the&nbsp;specified&nbsp;type&nbsp;on&nbsp;the&nbsp;room.&nbsp;By&nbsp;default,&nbsp;the<br>
  73. trigger&nbsp;owner&nbsp;is&nbsp;'me'.&nbsp;Other&nbsp;variables&nbsp;can&nbsp;be&nbsp;specified.&nbsp;The&nbsp;opts<br>
  74. variable&nbsp;can&nbsp;be&nbsp;a&nbsp;dictionary&nbsp;that&nbsp;maps&nbsp;optional&nbsp;variable&nbsp;names&nbsp;to&nbsp;their<br>
  75. values.</tt></dd></dl>
  76. <dl><dt><a name="Room-edesc"><strong>edesc</strong></a>(...)</dt><dd><tt><a href="#Room-edesc">edesc</a>(keywords,&nbsp;desc)<br>
  77. &nbsp;<br>
  78. Create&nbsp;an&nbsp;extra&nbsp;description&nbsp;for&nbsp;the&nbsp;room,&nbsp;accessible&nbsp;via&nbsp;a&nbsp;comma-<br>
  79. separated&nbsp;list&nbsp;of&nbsp;keywords.</tt></dd></dl>
  80. <dl><dt><a name="Room-exdir"><strong>exdir</strong></a>(...)</dt><dd><tt><a href="#Room-exdir">exdir</a>(exit)<br>
  81. &nbsp;<br>
  82. Returns&nbsp;the&nbsp;direction&nbsp;for&nbsp;a&nbsp;specified&nbsp;exit,&nbsp;or&nbsp;None.</tt></dd></dl>
  83. <dl><dt><a name="Room-exit"><strong>exit</strong></a>(...)</dt><dd><tt><a href="#Room-exit">exit</a>(dir)<br>
  84. &nbsp;<br>
  85. Returns&nbsp;an&nbsp;exit&nbsp;for&nbsp;the&nbsp;specified&nbsp;direction,&nbsp;or&nbsp;None.</tt></dd></dl>
  86. <dl><dt><a name="Room-fill"><strong>fill</strong></a>(...)</dt><dd><tt><a href="#Room-fill">fill</a>(dir)<br>
  87. &nbsp;<br>
  88. Erases&nbsp;an&nbsp;exit&nbsp;in&nbsp;the&nbsp;specified&nbsp;direction.</tt></dd></dl>
  89. <dl><dt><a name="Room-getAuxiliary"><strong>getAuxiliary</strong></a>(...)</dt><dd><tt><a href="#Room-getAuxiliary">getAuxiliary</a>(name)<br>
  90. &nbsp;<br>
  91. Returns&nbsp;room's&nbsp;auxiliary&nbsp;data&nbsp;of&nbsp;the&nbsp;specified&nbsp;name.</tt></dd></dl>
  92. <dl><dt><a name="Room-getvar"><strong>getvar</strong></a>(...)</dt><dd><tt><a href="#Room-getvar">getvar</a>(name)<br>
  93. &nbsp;<br>
  94. Return&nbsp;value&nbsp;of&nbsp;a&nbsp;special&nbsp;variable.&nbsp;Return&nbsp;0&nbsp;if&nbsp;no&nbsp;value&nbsp;has&nbsp;been&nbsp;set.</tt></dd></dl>
  95. <dl><dt><a name="Room-hasBit"><strong>hasBit</strong></a>(...)</dt><dd><tt><a href="#Room-hasBit">hasBit</a>(name)<br>
  96. &nbsp;<br>
  97. Return&nbsp;whether&nbsp;room&nbsp;has&nbsp;a&nbsp;bit&nbsp;toggled.</tt></dd></dl>
  98. <dl><dt><a name="Room-hasvar"><strong>hasvar</strong></a>(...)</dt><dd><tt><a href="#Room-hasvar">hasvar</a>(name)<br>
  99. &nbsp;<br>
  100. Return&nbsp;True&nbsp;if&nbsp;a&nbsp;room&nbsp;has&nbsp;the&nbsp;given&nbsp;special&nbsp;variable.&nbsp;False&nbsp;otherwise.</tt></dd></dl>
  101. <dl><dt><a name="Room-isinstance"><strong>isinstance</strong></a>(...)</dt><dd><tt><a href="#Room-isinstance">isinstance</a>(prototype)<br>
  102. &nbsp;<br>
  103. returns&nbsp;whether&nbsp;the&nbsp;room&nbsp;inherits&nbsp;from&nbsp;a&nbsp;specified&nbsp;room&nbsp;prototype.</tt></dd></dl>
  104. <dl><dt><a name="Room-reset"><strong>reset</strong></a>(...)</dt><dd><tt><a href="#Room-reset">reset</a>()<br>
  105. &nbsp;<br>
  106. Runs&nbsp;a&nbsp;room's&nbsp;reset&nbsp;commands&nbsp;and&nbsp;reset&nbsp;hooks.</tt></dd></dl>
  107. <dl><dt><a name="Room-send"><strong>send</strong></a>(...)</dt><dd><tt><a href="#Room-send">send</a>(mssg)<br>
  108. &nbsp;<br>
  109. Send&nbsp;a&nbsp;message&nbsp;to&nbsp;all&nbsp;characters&nbsp;in&nbsp;the&nbsp;room.</tt></dd></dl>
  110. <dl><dt><a name="Room-setvar"><strong>setvar</strong></a>(...)</dt><dd><tt><a href="#Room-setvar">setvar</a>(name,&nbsp;val)<br>
  111. &nbsp;<br>
  112. Set&nbsp;value&nbsp;of&nbsp;a&nbsp;special&nbsp;variable&nbsp;for&nbsp;the&nbsp;room.&nbsp;Values&nbsp;must&nbsp;be&nbsp;strings&nbsp;<br>
  113. or&nbsp;numbers.&nbsp;This&nbsp;function&nbsp;is&nbsp;intended&nbsp;to&nbsp;allow&nbsp;scripts&nbsp;and&nbsp;triggers&nbsp;toopen-endedly&nbsp;add&nbsp;variables&nbsp;to&nbsp;rooms.</tt></dd></dl>
  114. <hr>
  115. Data descriptors defined here:<br>
  116. <dl><dt><strong>bits</strong></dt>
  117. <dd><tt>A&nbsp;comma-separated&nbsp;list&nbsp;of&nbsp;setting&nbsp;bits&nbsp;currently&nbsp;toggled&nbsp;on&nbsp;the&nbsp;room.</tt></dd>
  118. </dl>
  119. <dl><dt><strong>chars</strong></dt>
  120. <dd><tt>A&nbsp;list&nbsp;of&nbsp;all&nbsp;characters&nbsp;in&nbsp;the&nbsp;room.&nbsp;Immutable.&nbsp;See&nbsp;char.Char.room<br>
  121. for&nbsp;changing&nbsp;the&nbsp;room&nbsp;a&nbsp;character&nbsp;is&nbsp;in.</tt></dd>
  122. </dl>
  123. <dl><dt><strong>contents</strong></dt>
  124. <dd><tt>A&nbsp;list&nbsp;of&nbsp;objects&nbsp;in&nbsp;the&nbsp;room.&nbsp;Immutable.&nbsp;See&nbsp;obj.Obj.room&nbsp;for<br>
  125. changing&nbsp;the&nbsp;room&nbsp;an&nbsp;object&nbsp;is&nbsp;in.</tt></dd>
  126. </dl>
  127. <dl><dt><strong>desc</strong></dt>
  128. <dd><tt>The&nbsp;room's&nbsp;description&nbsp;when,&nbsp;e.g.,&nbsp;looked&nbsp;at.</tt></dd>
  129. </dl>
  130. <dl><dt><strong>exnames</strong></dt>
  131. <dd><tt>A&nbsp;list&nbsp;of&nbsp;the&nbsp;room's&nbsp;exits,&nbsp;by&nbsp;direction.&nbsp;Immutable.&nbsp;See&nbsp;room.Room.dig<br>
  132. for&nbsp;creating&nbsp;new&nbsp;links&nbsp;between&nbsp;rooms.</tt></dd>
  133. </dl>
  134. <dl><dt><strong>locale</strong></dt>
  135. <dd><tt>The&nbsp;zone&nbsp;a&nbsp;room&nbsp;belongs&nbsp;to.&nbsp;Immutable.</tt></dd>
  136. </dl>
  137. <dl><dt><strong>name</strong></dt>
  138. <dd><tt>The&nbsp;room's&nbsp;name,&nbsp;e.g.,&nbsp;Town&nbsp;Square.</tt></dd>
  139. </dl>
  140. <dl><dt><strong>objs</strong></dt>
  141. <dd><tt>Alias&nbsp;for&nbsp;room.Room.contents</tt></dd>
  142. </dl>
  143. <dl><dt><strong>proto</strong></dt>
  144. <dd><tt>The&nbsp;room's&nbsp;unique&nbsp;identifier&nbsp;key.&nbsp;For&nbsp;non-instanced&nbsp;rooms,&nbsp;equivalent<br>
  145. to&nbsp;the&nbsp;main&nbsp;room&nbsp;prototype&nbsp;inherited&nbsp;from.&nbsp;Immutable.</tt></dd>
  146. </dl>
  147. <dl><dt><strong>protoname</strong></dt>
  148. <dd><tt>The&nbsp;first&nbsp;half&nbsp;of&nbsp;the&nbsp;room's&nbsp;unique&nbsp;identifier&nbsp;key.&nbsp;Immutable.</tt></dd>
  149. </dl>
  150. <dl><dt><strong>protos</strong></dt>
  151. <dd><tt>A&nbsp;comma-separated&nbsp;list&nbsp;of&nbsp;room&nbsp;prototypes&nbsp;this&nbsp;room&nbsp;inherits&nbsp;from.&nbsp;Immutable.</tt></dd>
  152. </dl>
  153. <dl><dt><strong>terrain</strong></dt>
  154. <dd><tt>The&nbsp;current&nbsp;terrain&nbsp;type&nbsp;of&nbsp;the&nbsp;room.</tt></dd>
  155. </dl>
  156. <dl><dt><strong>uid</strong></dt>
  157. <dd><tt>The&nbsp;room's&nbsp;unique&nbsp;identification&nbsp;number.&nbsp;Immutable.</tt></dd>
  158. </dl>
  159. <hr>
  160. Data and other attributes defined here:<br>
  161. <dl><dt><strong>__new__</strong> = &lt;built-in method __new__ of type object at 0x6f680&gt;<dd><tt>T.<a href="#Room-__new__">__new__</a>(S,&nbsp;...)&nbsp;-&gt;&nbsp;a&nbsp;new&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;with&nbsp;type&nbsp;S,&nbsp;a&nbsp;subtype&nbsp;of&nbsp;T</tt></dl>
  162. </td></tr></table></td></tr></table><p>
  163. <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
  164. <tr bgcolor="#eeaa77">
  165. <td colspan=3 valign=bottom>&nbsp;<br>
  166. <font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
  167. <tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
  168. <td width="100%"><dl><dt><a name="-get_room"><strong>get_room</strong></a>(...)</dt><dd><tt><a href="#-get_room">get_room</a>(key)<br>
  169. &nbsp;<br>
  170. Takes&nbsp;a&nbsp;room&nbsp;key/locale&nbsp;and&nbsp;returns&nbsp;the&nbsp;matching&nbsp;room,&nbsp;or&nbsp;None.</tt></dd></dl>
  171. <dl><dt><a name="-instance"><strong>instance</strong></a>(...)</dt><dd><tt><a href="#-instance">instance</a>(room_proto,&nbsp;as_key&nbsp;=&nbsp;None)<br>
  172. &nbsp;<br>
  173. Create&nbsp;an&nbsp;instanced&nbsp;copy&nbsp;of&nbsp;a&nbsp;room,&nbsp;specified&nbsp;by&nbsp;a&nbsp;room&nbsp;prototype&nbsp;name.<br>
  174. If&nbsp;as_key&nbsp;is&nbsp;None,&nbsp;the&nbsp;instanced&nbsp;room's&nbsp;key&nbsp;will&nbsp;be&nbsp;a&nbsp;derivation&nbsp;of<br>
  175. the&nbsp;original&nbsp;prototype&nbsp;name,&nbsp;with&nbsp;a&nbsp;uid&nbsp;number&nbsp;appended&nbsp;to&nbsp;it.&nbsp;Otherwise<br>
  176. as_key&nbsp;is&nbsp;used&nbsp;for&nbsp;the&nbsp;room's&nbsp;key.</tt></dd></dl>
  177. <dl><dt><a name="-is_abstract"><strong>is_abstract</strong></a>(...)</dt><dd><tt><a href="#-is_abstract">is_abstract</a>(proto)<br>
  178. &nbsp;<br>
  179. Returns&nbsp;whether&nbsp;a&nbsp;specified&nbsp;room&nbsp;prototype&nbsp;is&nbsp;abstract.&nbsp;Also&nbsp;return&nbsp;True<br>
  180. if&nbsp;the&nbsp;prototype&nbsp;does&nbsp;not&nbsp;exist.</tt></dd></dl>
  181. <dl><dt><a name="-is_loaded"><strong>is_loaded</strong></a>(...)</dt><dd><tt><a href="#-is_loaded">is_loaded</a>(key)<br>
  182. &nbsp;<br>
  183. Returns&nbsp;whether&nbsp;a&nbsp;room&nbsp;with&nbsp;the&nbsp;given&nbsp;key&nbsp;currently&nbsp;exists&nbsp;in&nbsp;game.</tt></dd></dl>
  184. </td></tr></table>
  185. </body></html>