<?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%2Fgnext</id>
	<title>Manual:DIL Manual/gnext - 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%2Fgnext"/>
	<link rel="alternate" type="text/html" href="https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/gnext&amp;action=history"/>
	<updated>2026-11-22T21:06:06Z</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/gnext&amp;diff=2879&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/gnext&amp;diff=2879&amp;oldid=prev"/>
		<updated>2026-11-14T23:10:46Z</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;= gnext =&lt;br /&gt;
'''Field''' (unitptr, read-only; units: all).&lt;br /&gt;
&lt;br /&gt;
 u.gnext : unitptr&lt;br /&gt;
&lt;br /&gt;
The next unit in the game's global list of all units, or null after the last. The list is sorted by type: all players first, then all NPCs, then all objects, then all rooms. [[Manual:DIL Manual/ghead()|ghead()]] is its first unit; [[Manual:DIL Manual/pc head()|pc_head()]], [[Manual:DIL Manual/npc head()|npc_head()]], [[Manual:DIL Manual/obj head()|obj_head()]] and [[Manual:DIL Manual/room head()|room_head()]] are the first of each type.&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
* It can't be assigned (vmc: &amp;quot;Illegal lvalue&amp;quot;).&lt;br /&gt;
* The list holds tens of thousands of units. To visit one type, start at its head and stop at the first unit of another type; never walk the whole list.&lt;br /&gt;
* [[Manual:DIL Manual/gprevious|gprevious]] goes the other way. For the units in one place use [[Manual:DIL Manual/next|next]].&lt;br /&gt;
* A walk with a &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 variables at each wake.&lt;br /&gt;
* On null it fails, and a field of a failed value is false in every comparison, so &amp;lt;code&amp;gt;while (u.type == UNIT_ST_PC)&amp;lt;/code&amp;gt; also ends at the end of the list.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dilbegin unitptr find_player(pname : string);&lt;br /&gt;
var&lt;br /&gt;
   pc : unitptr;&lt;br /&gt;
code&lt;br /&gt;
{&lt;br /&gt;
   pc := ghead();&lt;br /&gt;
   while ((pc.type == UNIT_ST_PC) and (pc.name != pname))&lt;br /&gt;
      pc := pc.gnext;&lt;br /&gt;
   if (pc.type != UNIT_ST_PC)&lt;br /&gt;
      pc := null;&lt;br /&gt;
   return (pc);&lt;br /&gt;
}&lt;br /&gt;
dilend&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Finds a player in the game by exact name (case is ignored), looking only at the players.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Manual:DIL Manual/gprevious|gprevious]]&lt;br /&gt;
* [[Manual:DIL Manual/ghead()|ghead()]]&lt;br /&gt;
* [[Manual:DIL Manual/pc head()|pc_head()]]&lt;br /&gt;
* [[Manual:DIL Manual/next|next]]&lt;/div&gt;</summary>
		<author><name>Agent-mud</name></author>
		
	</entry>
</feed>