Annotation of embedaddon/mpd/doc/mpd59.html, revision 1.1.1.1

1.1       misho       1: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
                      2: <HTML>
                      3: <HEAD>
                      4: <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
                      5: <TITLE>Script commands</TITLE>
                      6: </HEAD>
                      7: <BODY text="#000000" bgcolor="#ffffff">
                      8: 
                      9: <A HREF="mpd.html"><EM>Mpd 5.6 User Manual</EM></A>
                     10:  <b>:</b> <A HREF="mpd50.html"><EM>Chat Scripting</EM></A>
                     11:  <b>:</b> <EM>Script commands</EM><BR>
                     12: <b>Previous:</b> <A HREF="mpd58.html"><EM>Special variables</EM></A><BR>
                     13: <b>Next:</b> <A HREF="mpd60.html"><EM>Errors</EM></A>
                     14: 
                     15: 
                     16: <HR NOSHADE>
                     17:   <H2><A NAME="59"></A>6.5. Script commands</H2>
                     18: <p>
                     19: <dl>
                     20: 
                     21: <dt><b><code>set $<em>variable-name</em> <em>string</em> </code></b><dd><p>Set the <code>$<em>variable-name</em></code> equal to
                     22: <code><em>string</em></code>. The <code><em>string</em></code> is
                     23: variable expanded first.</p>
                     24: 
                     25: <dt><b><code>match <em>name</em> <em>string</em> <em>label</em> </code></b><dd>
                     26: <dt><b><code>match <em>string</em> <em>label</em> </code></b><dd>
                     27: <dt><b><code>match <em>string</em> </code></b><dd>
                     28: <p>Add a new pending event to event set <code><em>name</em></code>
                     29: such that when <code><em>string</em></code> is seen in the input,
                     30: resume execution at <code><em>label</em></code>. The match must
                     31: be exact. All arguments are variable expanded.</p>
                     32: <p>If no <code><em>name</em></code> is given, or if <code><em>name</em></code>
                     33: is the empty string, add the new event to the default set.</p>
                     34: <p>If no <code><em>label</em></code> is given, or if <code><em>label</em></code>
                     35: is the empty string, the event causes execution to resume
                     36: starting with the statement following the <code>wait</code> command
                     37: (i.e., use the default target).</p>
                     38: 
                     39: <dt><b><code>regex <em>name</em> <em>pattern</em> <em>label</em> </code></b><dd>
                     40: <dt><b><code>regex <em>pattern</em> <em>label</em> </code></b><dd>
                     41: <dt><b><code>regex <em>pattern</em> </code></b><dd>
                     42: <p>Same as the <code>match</code> command, but matches an extended
                     43: regular expression instead of an exact string. If
                     44: <code><em>pattern</em></code> is not a valid extended regular
                     45: expression, the script fails.</p>
                     46: <p>Regular expressions are matched on a line-by-line basis; the
                     47: input matching the pattern cannot span more than one line.  A
                     48: line is terminated with either a newline or a carriage return-newline
                     49: pair (the latter is more common). An end-of-line should
                     50: be matched using a dollar sign rather than trying to match these
                     51: characters directly, as mpd elides them from the input when
                     52: testing the regular expression.</p>
                     53: <p>See <code>re_format(7)</code> for more information about extended
                     54: regular expressions.</p>
                     55: 
                     56: <dt><b><code>timer <em>name</em> <em>seconds</em> <em>label</em> </code></b><dd>
                     57: <dt><b><code>timer <em>seconds</em> <em>label</em> </code></b><dd>
                     58: <dt><b><code>timer <em>seconds</em> </code></b><dd>
                     59: <p>Add a new pending event to set <code><em>name</em></code> such that
                     60: when <code><em>seconds</em></code> seconds have elapsed,
                     61: resume execution at <code><em>label</em></code>.
                     62: All arguments are variable expanded.</p>
                     63: <p>If no <code><em>name</em></code> is given, or if <code><em>name</em></code>
                     64: is the empty string, add the new event to the default set.</p>
                     65: <p>If no <code><em>label</em></code> is given, or if <code><em>label</em></code>
                     66: is the empty string, the event causes execution to resume
                     67: starting with the statement following the <code>wait</code> command
                     68: (i.e., use the default target).</p>
                     69: 
                     70: <dt><b><code>wait </code></b><dd>
                     71: <dt><b><code>wait <em>seconds</em> </code></b><dd>
                     72: <p>In the first form, wait indefinitely for any event to happen.
                     73: When an event happens, continue execution starting at the target
                     74: label for that event.</p>
                     75: <p>The second form is equivalent to:</p>
                     76: <p>
                     77: <blockquote><code>
                     78: <code>timer <em>seconds</em><br>
                     79: wait</code>
                     80: </code></blockquote>
                     81: </p>
                     82: 
                     83: <dt><b><code>if <em>string1</em> == <em>string2</em>
                     84: <em>command</em> </code></b><dd>
                     85: <dt><b><code>if <em>string1</em> != <em>string2</em>
                     86: <em>command</em> </code></b><dd>
                     87: <p>Executes <code><em>command</em></code> if the two variable expanded
                     88: strings are equal or not equal.</p>
                     89: 
                     90: <dt><b><code>if <em>string</em> match <em>pattern</em>
                     91: <em>command</em> </code></b><dd>
                     92: <dt><b><code>if <em>string</em> !match <em>pattern</em>
                     93: <em>command</em> </code></b><dd>
                     94: <p>Tests <code><em>string</em></code> against the regular expression
                     95: <code><em>pattern</em></code> and executes <code><em>command</em></code>
                     96: if <code><em>string</em></code> matches or does not match.  Both
                     97: <code><em>string</em></code> and <code><em>pattern</em></code> are
                     98: variable expanded first.</p>
                     99: 
                    100: <dt><b><code>print <em>string</em> </code></b><dd><p>Ouput the <code><em>string</em></code> to the serial port.
                    101: Variables are expanded, and the normal mpd C-style character
                    102: escapes may be used.</p>
                    103: 
                    104: <dt><b><code>cancel <em>name1</em> [ <em>name2</em> ... ] </code></b><dd><p>Cancel all pending events in the sets <code><em>name1</em></code>,
                    105: <code><em>name2</em></code>, etc.
                    106: It is not an error to cancel a set which is already empty.</p>
                    107: 
                    108: <dt><b><code>goto <em>label</em> </code></b><dd><p>Jump to label <code><em>label</em></code>.</p>
                    109: 
                    110: <dt><b><code>call <em>label</em> </code></b><dd><p>Call a subroutine at <code><em>label</em></code>.</p>
                    111: 
                    112: <dt><b><code>return </code></b><dd><p>Return from subroutine.</p>
                    113: 
                    114: <dt><b><code>success </code></b><dd><p>Exit the script successfully.</p>
                    115: 
                    116: <dt><b><code>failure </code></b><dd><p>Exit the script unsuccessfully.</p>
                    117: 
                    118: <dt><b><code>log <em>string</em> </code></b><dd><p>Print <code><em>string</em></code>, variable expanded, to the log
                    119: file under logging level CHAT.</p>
                    120: 
                    121: </dl>
                    122: </p>
                    123: 
                    124:  <HR NOSHADE>
                    125: <A HREF="mpd.html"><EM>Mpd 5.6 User Manual</EM></A>
                    126:  <b>:</b> <A HREF="mpd50.html"><EM>Chat Scripting</EM></A>
                    127:  <b>:</b> <EM>Script commands</EM><BR>
                    128: <b>Previous:</b> <A HREF="mpd58.html"><EM>Special variables</EM></A><BR>
                    129: <b>Next:</b> <A HREF="mpd60.html"><EM>Errors</EM></A>
                    130: 
                    131: 
                    132: 
                    133: </BODY>
                    134: </HTML>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>