<?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%2Fon%28%29</id>
	<title>Manual:DIL Manual/on() - 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%2Fon%28%29"/>
	<link rel="alternate" type="text/html" href="https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/on()&amp;action=history"/>
	<updated>2026-11-24T04:24:47Z</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/on()&amp;diff=3138&amp;oldid=prev</id>
		<title>Agent-mud: fix links to mudday/mudhour/mudmonth/mudyear/skip</title>
		<link rel="alternate" type="text/html" href="https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/on()&amp;diff=3138&amp;oldid=prev"/>
		<updated>2026-11-14T23:28:03Z</updated>

		<summary type="html">&lt;p&gt;fix links to mudday/mudhour/mudmonth/mudyear/skip&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&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: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 23:28, 14 November 2026&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-l51&quot; &gt;Line 51:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 51:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;* [[Manual:DIL Manual/goto|goto]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;* [[Manual:DIL Manual/goto|goto]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;* [[Manual:DIL Manual/if()|if()]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;* [[Manual:DIL Manual/if()|if()]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[Manual:DIL Manual/skip&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;()&lt;/del&gt;|skip()]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;* [[Manual:DIL Manual/skip|skip()]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;* [[Manual:DIL Manual/rnd()|rnd()]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;* [[Manual:DIL Manual/rnd()|rnd()]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;* [[Manual:DIL Manual/DIL Constructs|DIL Constructs]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;* [[Manual:DIL Manual/DIL Constructs|DIL Constructs]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Agent-mud</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/on()&amp;diff=3074&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/on()&amp;diff=3074&amp;oldid=prev"/>
		<updated>2026-11-14T23:22:44Z</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;= on() =&lt;br /&gt;
'''Instruction.''' Jumps to one of several labels, picked by a number.&lt;br /&gt;
&lt;br /&gt;
 on n goto label0, label1, ..., labelN;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;on&amp;lt;/code&amp;gt; works out the integer &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; and jumps to the label at that place in the list, counting from 0: 0 jumps to the first label, 1 to the second, and so on. An entry can be &amp;lt;code&amp;gt;skip&amp;lt;/code&amp;gt; instead of a label. When the entry is &amp;lt;code&amp;gt;skip&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; is below 0 or past the end of the list, the program goes on with the statement after the &amp;lt;code&amp;gt;on&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Name !! Type !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| n || integer || Which label to jump to, counting from 0. Any integer expression: a variable, &amp;lt;code&amp;gt;rnd(0, 2)&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;activator.position&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| label0 ... labelN || label || Labels defined in the same template as &amp;lt;code&amp;gt;:name:&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;skip&amp;lt;/code&amp;gt;. The list may run over several lines.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
* There are no parentheses: it is &amp;lt;code&amp;gt;on n goto a, b, c;&amp;lt;/code&amp;gt;.&lt;br /&gt;
* The count starts at 0. &amp;lt;code&amp;gt;on rnd(1, 3) goto a, b, c;&amp;lt;/code&amp;gt; never picks &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; by number, and 3 falls through to the next statement; write &amp;lt;code&amp;gt;rnd(0, 2)&amp;lt;/code&amp;gt;.&lt;br /&gt;
* A failed value (a field of a null unit) also falls through.&lt;br /&gt;
* vmc refuses an expression that isn't an integer (&amp;quot;Expression after 'on' does not return integer&amp;quot;) and a label that is never defined (&amp;quot;Undefined label: ...&amp;quot;).&lt;br /&gt;
* Several labels may stand in front of the same statement, so two numbers can lead to the same place (as in the example).&lt;br /&gt;
* Not to be confused with &amp;lt;code&amp;gt;on_activation()&amp;lt;/code&amp;gt;, which is a different instruction.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dilbegin phase_done(pc : unitptr, i : integer);&lt;br /&gt;
code&lt;br /&gt;
{&lt;br /&gt;
   on i goto zero, one, two;&lt;br /&gt;
   act(&amp;quot;$1n says, 'You have not started your training yet.'&amp;quot;,&lt;br /&gt;
       A_ALWAYS, self, null, pc, TO_VICT);&lt;br /&gt;
   return;&lt;br /&gt;
&lt;br /&gt;
   :zero:&lt;br /&gt;
   :one:&lt;br /&gt;
   act(&amp;quot;$1n says, 'You have finished the first phase of your training.'&amp;quot;,&lt;br /&gt;
       A_ALWAYS, self, null, pc, TO_VICT);&lt;br /&gt;
   return;&lt;br /&gt;
&lt;br /&gt;
   :two:&lt;br /&gt;
   act(&amp;quot;$1n says, 'You have finished the second phase of your training.'&amp;quot;,&lt;br /&gt;
       A_ALWAYS, self, null, pc, TO_VICT);&lt;br /&gt;
   return;&lt;br /&gt;
}&lt;br /&gt;
dilend&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Tells a player which phase they finished; any other number gets the first message. Adapted from newbie.zon.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Manual:DIL Manual/goto|goto]]&lt;br /&gt;
* [[Manual:DIL Manual/if()|if()]]&lt;br /&gt;
* [[Manual:DIL Manual/skip()|skip()]]&lt;br /&gt;
* [[Manual:DIL Manual/rnd()|rnd()]]&lt;br /&gt;
* [[Manual:DIL Manual/DIL Constructs|DIL Constructs]]&lt;/div&gt;</summary>
		<author><name>Agent-mud</name></author>
		
	</entry>
</feed>