123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
- <html><head><title>Python: routine</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>routine</strong></big></big></font></td
- ><td align=right valign=bottom
- ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/Users/hollis/Desktop/nakedmud/lib/pymodules/routine.py">/Users/hollis/Desktop/nakedmud/lib/pymodules/routine.py</a></font></td></tr></table>
- <p><tt>routine.py<br>
- <br>
- This is a module for setting up one-time or repeatable routines for mobs. This<br>
- can include walking a path, forging a sword, singing verses of a song, or<br>
- anything else. This was primarily meant to be for path-following, but I figured<br>
- it was worth the time to generalize it out for more complex actions</tt></p>
- <p>
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
- <tr bgcolor="#aa55cc">
- <td colspan=3 valign=bottom> <br>
- <font color="#fffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
-
- <tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
- <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="auxiliary.html">auxiliary</a><br>
- <a href="event.html">event</a><br>
- </td><td width="25%" valign=top><a href="mud.html">mud</a><br>
- <a href="mudsys.html">mudsys</a><br>
- </td><td width="25%" valign=top><a href="storage.html">storage</a><br>
- </td><td width="25%" valign=top></td></tr></table></td></tr></table><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="routine.html#RoutineAuxData">RoutineAuxData</a>
- </font></dt></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="RoutineAuxData">class <strong>RoutineAuxData</strong></a></font></td></tr>
-
- <tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
- <td colspan=2><tt>Holds character data related to character routines.<br> </tt></td></tr>
- <tr><td> </td>
- <td width="100%">Methods defined here:<br>
- <dl><dt><a name="RoutineAuxData-__init__"><strong>__init__</strong></a>(self, set<font color="#909090">=None</font>)</dt></dl>
- <dl><dt><a name="RoutineAuxData-copy"><strong>copy</strong></a>(self)</dt></dl>
- <dl><dt><a name="RoutineAuxData-copyTo"><strong>copyTo</strong></a>(self, to)</dt></dl>
- <dl><dt><a name="RoutineAuxData-read"><strong>read</strong></a>(self, set)</dt></dl>
- <dl><dt><a name="RoutineAuxData-store"><strong>store</strong></a>(self)</dt></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="-cmd_routine"><strong>cmd_routine</strong></a>(ch, cmd, arg)</dt><dd><tt>Appends a routine onto a character. The second argument needs to be an<br>
- evaluable list statement. Put it in parentheses to avoid being cut off<br>
- as spaces, since parse treats it as a single word. Example:<br>
- <br>
- > routine man "['say hi', (3, 'say I am a little teapot')]" True<br>
- <br>
- this will say hi after the default delay, and I am a little teapot after<br>
- a delay of 3. It will then loop through this process indefinitely.<br>
- Alternatively, these commands can be replaced with function calls.</tt></dd></dl>
- <dl><dt><a name="-do_step"><strong>do_step</strong></a>(ch)</dt><dd><tt>Performs the current step increments</tt></dd></dl>
- <dl><dt><a name="-register_routine_check"><strong>register_routine_check</strong></a>(check)</dt><dd><tt>adds a routine check to the global list. Must be a function taking one<br>
- argument, which is the character doing the routine. Return should be<br>
- True if the check succeeded (i.e., we should not do a routine)</tt></dd></dl>
- <dl><dt><a name="-routine_event"><strong>routine_event</strong></a>(owner, data, arg)</dt><dd><tt>this is the event that perpetuates NPC routines. Each NPC that has a<br>
- routine running has one of these events tied to him or her. When the<br>
- routine time expires, a check is made to see if the routine can go on.<br>
- If it can, the routine step is performed and the step number is<br>
- incremented</tt></dd></dl>
- <dl><dt><a name="-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="-start_routine"><strong>start_routine</strong></a>(ch)</dt><dd><tt>starts a character routine event in motion</tt></dd></dl>
- <dl><dt><a name="-try_step"><strong>try_step</strong></a>(ch)</dt><dd><tt>Checks to see if we can perform a step in the routine. Returns true or<br>
- false if it did or not</tt></dd></dl>
- </td></tr></table><p>
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
- <tr bgcolor="#55aa55">
- <td colspan=3 valign=bottom> <br>
- <font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
-
- <tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
- <td width="100%"><strong>__dflt_routine_step_time__</strong> = 10<br>
- <strong>__global_routine_checks__</strong> = [<function <lambda> at 0x105b170>]</td></tr></table>
- </body></html>
|