<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.mudlet.org/index.php?action=history&amp;feed=atom&amp;title=Wait_and_wait_line_script</id>
	<title>Wait and wait line script - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.mudlet.org/index.php?action=history&amp;feed=atom&amp;title=Wait_and_wait_line_script"/>
	<link rel="alternate" type="text/html" href="https://wiki.mudlet.org/index.php?title=Wait_and_wait_line_script&amp;action=history"/>
	<updated>2026-06-20T12:55:00Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.0</generator>
	<entry>
		<id>https://wiki.mudlet.org/index.php?title=Wait_and_wait_line_script&amp;diff=20600&amp;oldid=prev</id>
		<title>Zooka at 07:33, 11 December 2023</title>
		<link rel="alternate" type="text/html" href="https://wiki.mudlet.org/index.php?title=Wait_and_wait_line_script&amp;diff=20600&amp;oldid=prev"/>
		<updated>2023-12-11T07:33:49Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 07:33, 11 December 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Mudlet Package Listing]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 70%;&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 70%;&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wikidb:diff::1.12:old-20598:rev-20600 --&gt;
&lt;/table&gt;</summary>
		<author><name>Zooka</name></author>
	</entry>
	<entry>
		<id>https://wiki.mudlet.org/index.php?title=Wait_and_wait_line_script&amp;diff=20598&amp;oldid=prev</id>
		<title>Zooka: initial creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.mudlet.org/index.php?title=Wait_and_wait_line_script&amp;diff=20598&amp;oldid=prev"/>
		<updated>2023-12-11T07:31:46Z</updated>

		<summary type="html">&lt;p&gt;initial creation&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width: 70%;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 10%&amp;quot; | Game || &amp;lt;!-- game name|non-mud specific --&amp;gt; non-mud specific&lt;br /&gt;
|-&lt;br /&gt;
| By || zenzh&lt;br /&gt;
|-&lt;br /&gt;
| Download || [https://forums.mudlet.org/download/file.php?id=2027 Mudlet Forums]&lt;br /&gt;
|-&lt;br /&gt;
| Dependencies || &amp;lt;!-- any package dependencies|mudlet version requirements --&amp;gt; Mudlet 4.17&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Description =  &lt;br /&gt;
The script is to implement the result that suspend current function and waiting specified time or pattern coming.&lt;br /&gt;
It helps combining simple actions to a set of action chain which get your functions modular.  As the functions uses co-routine yield/resume, you have to wrap all your implementation in a co-routine function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
; wait(time)&lt;br /&gt;
: Get your function flow being suspended for specified time.&lt;br /&gt;
; Parameters&lt;br /&gt;
: time: the time in seconds for which to wait&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
; wait_line(pattern, timeout[, action])&lt;br /&gt;
: Get your function flow being suspended until the specified pattern line coming. Matched values from regex will be returned.&lt;br /&gt;
; Parameters&lt;br /&gt;
: pattern: string or table regular expression that lines will be matched on, function flow will not go ahead until this pattern is matched.  When using table pattern format, multiple patterns can be specified to simulate waitting multi-line.  Lines will be compared one after another as the sequence of the table. The flow will not go ahead until all patterns are matched.&lt;br /&gt;
: timeout: seconds to wait for the pattern line, will resume the coroutine with false returned. 0 for no timeout.&lt;br /&gt;
: action (optional): any behavior commands to be sent to server, multiple commands can be accepted with command separator.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
See also: [http://https://forums.mudlet.org/viewtopic.php?f=6&amp;amp;t=22875&amp;amp;sid=af8c3e2ff5d024ef4229dce1aa274c42 Mudlet Forums]&lt;br /&gt;
&lt;br /&gt;
= Examples = &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
coroutine.wrap(function()&lt;br /&gt;
    send(&amp;quot;say this is a test&amp;quot;)&lt;br /&gt;
    wait(3)&lt;br /&gt;
    send(&amp;quot;say 3 seconds later&amp;quot;)&lt;br /&gt;
end)()&lt;br /&gt;
&lt;br /&gt;
function kill_enemy(target)&lt;br /&gt;
    local result = wait_line([[^(\S+) die]], &amp;quot;kill &amp;quot;..target)&lt;br /&gt;
    if result[2] == target then&lt;br /&gt;
        return true&lt;br /&gt;
    else&lt;br /&gt;
        return false&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
coroutine.wrap(function()&lt;br /&gt;
    if kill_enemy(&amp;quot;monster&amp;quot;) == true then&lt;br /&gt;
        send(&amp;quot;say job success&amp;quot;)&lt;br /&gt;
    else&lt;br /&gt;
        send(&amp;quot;say job fail&amp;quot;)&lt;br /&gt;
    end&lt;br /&gt;
end)()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Zooka</name></author>
	</entry>
</feed>