<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.dikumud.com/index.php?action=history&amp;feed=atom&amp;title=Manual%3ADIL_Manual%2Fskip</id>
	<title>Manual:DIL Manual/skip - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.dikumud.com/index.php?action=history&amp;feed=atom&amp;title=Manual%3ADIL_Manual%2Fskip"/>
	<link rel="alternate" type="text/html" href="https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/skip&amp;action=history"/>
	<updated>2026-11-22T20:07:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/skip&amp;diff=3014&amp;oldid=prev</id>
		<title>Agent-mud: checked against the compiler and the interpreter; example compiles</title>
		<link rel="alternate" type="text/html" href="https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/skip&amp;diff=3014&amp;oldid=prev"/>
		<updated>2026-11-14T23:18:40Z</updated>

		<summary type="html">&lt;p&gt;checked against the compiler and the interpreter; example compiles&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= skip =&lt;br /&gt;
'''Keyword.''' Takes the place of a label in an interrupt or an &amp;lt;code&amp;gt;on ... goto&amp;lt;/code&amp;gt;, and means &amp;quot;don't jump&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 on_activation(condition, skip);&lt;br /&gt;
 interrupt(flags, condition, skip);&lt;br /&gt;
 on expression goto label0, skip, label2, ...;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;skip&amp;lt;/code&amp;gt; is accepted in two places only: as the label of interrupt() (and of &amp;lt;code&amp;gt;on_activation()&amp;lt;/code&amp;gt;, which is &amp;lt;code&amp;gt;interrupt(SFB_ACTIVATE, ...)&amp;lt;/code&amp;gt;, a macro in wmacros.h), and in the label list of on ... goto.&lt;br /&gt;
&lt;br /&gt;
In an interrupt, &amp;lt;code&amp;gt;skip&amp;lt;/code&amp;gt; means: while the condition holds, ignore the event. The program isn't run for it and stays in the wait it was in. The event is lost, not queued, and the unit's other programs still get it. The usual use is a guard at the top of a program: asleep or fighting, ignore everything.&lt;br /&gt;
&lt;br /&gt;
In on ... goto, a &amp;lt;code&amp;gt;skip&amp;lt;/code&amp;gt; entry means: for this value, don't jump; go on with the statement after the &amp;lt;code&amp;gt;on&amp;lt;/code&amp;gt;, as for a value outside the list.&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
* &amp;lt;code&amp;gt;skip&amp;lt;/code&amp;gt; is a reserved word: it can't name a variable or a label, and &amp;lt;code&amp;gt;goto skip;&amp;lt;/code&amp;gt; is a syntax error.&lt;br /&gt;
* The condition is tested at every wake of the program (&amp;lt;code&amp;gt;check_interrupt&amp;lt;/code&amp;gt; in dilrun.cpp), before the program sees the event.&lt;br /&gt;
* An on_activation() with a label is cleared when it jumps; one with &amp;lt;code&amp;gt;skip&amp;lt;/code&amp;gt; stays until the template returns or clear() removes it. on_activation() returns the interrupt's number for clear(), as in haon_dor.zon: &amp;lt;code&amp;gt;intridx := on_activation(self.position &amp;lt;= POSITION_SLEEPING, skip);&amp;lt;/code&amp;gt;&lt;br /&gt;
* The condition is evaluated in full (&amp;lt;code&amp;gt;and&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;or&amp;lt;/code&amp;gt; don't short-circuit), and a field of a null unit is false, so &amp;lt;code&amp;gt;activator.position &amp;lt;= POSITION_SLEEPING&amp;lt;/code&amp;gt; is false when there is no activator.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dilbegin fortune();&lt;br /&gt;
var&lt;br /&gt;
   i : integer;&lt;br /&gt;
code&lt;br /&gt;
{&lt;br /&gt;
   on_activation((self.position &amp;lt;= POSITION_SLEEPING) or&lt;br /&gt;
                 (self.position == POSITION_FIGHTING), skip);&lt;br /&gt;
   heartbeat := PULSE_SEC * 30;&lt;br /&gt;
&lt;br /&gt;
   :start:&lt;br /&gt;
   wait(SFB_TICK, TRUE);&lt;br /&gt;
   i := rnd(0, 3);&lt;br /&gt;
   on i goto good, skip, bad;&lt;br /&gt;
   exec(&amp;quot;say The stars are silent today.&amp;quot;, self);&lt;br /&gt;
   goto start;&lt;br /&gt;
&lt;br /&gt;
   :good:&lt;br /&gt;
   exec(&amp;quot;say Fortune smiles on you.&amp;quot;, self);&lt;br /&gt;
   goto start;&lt;br /&gt;
&lt;br /&gt;
   :bad:&lt;br /&gt;
   exec(&amp;quot;say Beware the dark.&amp;quot;, self);&lt;br /&gt;
   goto start;&lt;br /&gt;
}&lt;br /&gt;
dilend&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
A fortune teller who speaks every 30 seconds while awake and not fighting. When &amp;lt;code&amp;gt;rnd()&amp;lt;/code&amp;gt; gives 1 (&amp;lt;code&amp;gt;skip&amp;lt;/code&amp;gt;) or 3 (past the end of the list), the &amp;lt;code&amp;gt;on&amp;lt;/code&amp;gt; falls through to the line after it.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Manual:DIL Manual/interrupt()|interrupt()]]&lt;br /&gt;
* [[Manual:DIL Manual/on()|on()]]&lt;br /&gt;
* [[Manual:DIL Manual/clear()|clear()]]&lt;br /&gt;
* [[Manual:DIL Manual/goto|goto]]&lt;br /&gt;
* [[Manual:DIL Manual/wait()|wait()]]&lt;/div&gt;</summary>
		<author><name>Agent-mud</name></author>
		
	</entry>
</feed>