<?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%2Fzhead%28%29</id>
	<title>Manual:DIL Manual/zhead() - 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%2Fzhead%28%29"/>
	<link rel="alternate" type="text/html" href="https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/zhead()&amp;action=history"/>
	<updated>2026-11-25T05:18:57Z</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/zhead()&amp;diff=2968&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/zhead()&amp;diff=2968&amp;oldid=prev"/>
		<updated>2026-11-14T23:15:38Z</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;= zhead() =&lt;br /&gt;
'''Function''' (zoneptr). The first zone in the game.&lt;br /&gt;
&lt;br /&gt;
 zhead()&lt;br /&gt;
&lt;br /&gt;
Returns the first of the game's zones, sorted by zone name. Each zone's &amp;lt;code&amp;gt;next&amp;lt;/code&amp;gt; field is the zone after it, and null after the last one, so a loop from &amp;lt;code&amp;gt;zhead()&amp;lt;/code&amp;gt; visits every zone. Zone fields such as &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;notes&amp;lt;/code&amp;gt; can then be read.&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
Zoneptr: the zone whose name comes first in alphabetical order.&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
* &amp;lt;code&amp;gt;zone_head()&amp;lt;/code&amp;gt; is another name for the same function.&lt;br /&gt;
* The order is by name (byte order; zone names are lower case), not the order of &amp;lt;code&amp;gt;vme/etc/zonelist&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;z.next&amp;lt;/code&amp;gt; on a null zoneptr fails; test the pointer in the loop: &amp;lt;code&amp;gt;while (z)&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;while (z != null)&amp;lt;/code&amp;gt;.&lt;br /&gt;
* A field can't be read straight off the call: &amp;lt;code&amp;gt;zhead().next&amp;lt;/code&amp;gt; is a syntax error. Put the zone in a variable first.&lt;br /&gt;
* To get one zone by name, &amp;lt;code&amp;gt;findzone()&amp;lt;/code&amp;gt; is simpler.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dilbegin zoneptr zone_of(rm : unitptr);&lt;br /&gt;
var&lt;br /&gt;
   z : zoneptr;&lt;br /&gt;
code&lt;br /&gt;
{&lt;br /&gt;
   z := zhead();&lt;br /&gt;
   while ((z != null) and (z.name != rm.zoneidx))&lt;br /&gt;
      z := z.next;&lt;br /&gt;
   return (z);&lt;br /&gt;
}&lt;br /&gt;
dilend&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finds the zone a room belongs to, as helpzon.zon does for &amp;lt;code&amp;gt;help area&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Manual:DIL Manual/zone head()|zone_head()]]&lt;br /&gt;
* [[Manual:DIL Manual/findzone()|findzone()]]&lt;br /&gt;
* [[Manual:DIL Manual/zoneptr|zoneptr]]&lt;br /&gt;
* [[Manual:DIL Manual/next|next]]&lt;br /&gt;
* [[Manual:DIL Manual/zoneidx|zoneidx]]&lt;/div&gt;</summary>
		<author><name>Agent-mud</name></author>
		
	</entry>
</feed>