<?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%2Fnext</id>
	<title>Manual:DIL Manual/next - 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%2Fnext"/>
	<link rel="alternate" type="text/html" href="https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/next&amp;action=history"/>
	<updated>2026-11-23T20:48:04Z</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/next&amp;diff=2817&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/next&amp;diff=2817&amp;oldid=prev"/>
		<updated>2026-11-14T23:00:18Z</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;= next =&lt;br /&gt;
'''Field''' (same type as the value it is taken from, read-only; on unitptr, extraptr, zoneptr and cmdptr).&lt;br /&gt;
&lt;br /&gt;
 u.next : unitptr&lt;br /&gt;
 e.next : extraptr&lt;br /&gt;
 z.next : zoneptr&lt;br /&gt;
 c.next : cmdptr&lt;br /&gt;
&lt;br /&gt;
The next element of the list the value is in, or null after the last one:&lt;br /&gt;
* '''unitptr''': the next unit in the same place (the next one in &amp;lt;code&amp;gt;u.outside.inside&amp;lt;/code&amp;gt;). Start with &amp;lt;code&amp;gt;.inside&amp;lt;/code&amp;gt; of a room or container.&lt;br /&gt;
* '''extraptr''': the next extra description. Start with &amp;lt;code&amp;gt;.extra&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;.info&amp;lt;/code&amp;gt;.&lt;br /&gt;
* '''zoneptr''': the next zone, in alphabetical order of zone names. Start with [[Manual:DIL Manual/zhead()|zhead()]].&lt;br /&gt;
* '''cmdptr''': the next command. Start with [[Manual:DIL Manual/chead()|chead()]].&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
* On null it fails, except on an extraptr, where it gives null.&lt;br /&gt;
* It can't be assigned (vmc: &amp;quot;Illegal lvalue&amp;quot;).&lt;br /&gt;
* For the global list of all units use [[Manual:DIL Manual/gnext|gnext]] instead.&lt;br /&gt;
* A &amp;lt;code&amp;gt;while&amp;lt;/code&amp;gt; loop that moves or kills units while it walks &amp;lt;code&amp;gt;.next&amp;lt;/code&amp;gt; goes wrong: after &amp;lt;code&amp;gt;link(u, elsewhere)&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;u.next&amp;lt;/code&amp;gt; is in the other place. Use [[Manual:DIL Manual/foreach()|foreach()]] for that.&lt;br /&gt;
* A loop with &amp;lt;code&amp;gt;wait&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;pause&amp;lt;/code&amp;gt; in it loses its unitptr and extraptr variables at every wake.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dilbegin count_items();&lt;br /&gt;
var&lt;br /&gt;
   u : unitptr;&lt;br /&gt;
   n : integer;&lt;br /&gt;
code&lt;br /&gt;
{&lt;br /&gt;
   u := self.outside.inside;&lt;br /&gt;
   while (u)&lt;br /&gt;
   {&lt;br /&gt;
      if (u.type == UNIT_ST_OBJ)&lt;br /&gt;
         n := n + 1;&lt;br /&gt;
      u := u.next;&lt;br /&gt;
   }&lt;br /&gt;
   act(&amp;quot;There are &amp;quot; + itoa(n) + &amp;quot; things lying here.&amp;quot;, A_ALWAYS, self, null, null, TO_CHAR);&lt;br /&gt;
   quit;&lt;br /&gt;
}&lt;br /&gt;
dilend&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Counts the objects in the room.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Manual:DIL Manual/inside|inside]]&lt;br /&gt;
* [[Manual:DIL Manual/gnext|gnext]]&lt;br /&gt;
* [[Manual:DIL Manual/foreach()|foreach()]]&lt;br /&gt;
* [[Manual:DIL Manual/zhead()|zhead()]]&lt;br /&gt;
* [[Manual:DIL Manual/chead()|chead()]]&lt;/div&gt;</summary>
		<author><name>Agent-mud</name></author>
		
	</entry>
</feed>