<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://agiwiki.sierrahelp.com//index.php?action=history&amp;feed=atom&amp;title=End.of.loop</id>
	<title>End.of.loop - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://agiwiki.sierrahelp.com//index.php?action=history&amp;feed=atom&amp;title=End.of.loop"/>
	<link rel="alternate" type="text/html" href="http://agiwiki.sierrahelp.com//index.php?title=End.of.loop&amp;action=history"/>
	<updated>2026-09-19T14:27:39Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.9</generator>
	<entry>
		<id>http://agiwiki.sierrahelp.com//index.php?title=End.of.loop&amp;diff=12080&amp;oldid=prev</id>
		<title>Andrew Korson: Created page with &quot;The &#039;&#039;&#039;end.of.loop&#039;&#039;&#039; command switches an object&#039;s cycle mode to &amp;lsquo;end of loop&amp;rsquo;.  == Syntax ==  end.of.loop(obj oA, flg fDONE);  == R...&quot;</title>
		<link rel="alternate" type="text/html" href="http://agiwiki.sierrahelp.com//index.php?title=End.of.loop&amp;diff=12080&amp;oldid=prev"/>
		<updated>2019-03-30T19:01:43Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;The &amp;#039;&amp;#039;&amp;#039;end.of.loop&amp;#039;&amp;#039;&amp;#039; command switches an object&amp;#039;s &lt;a href=&quot;/index.php?title=Cycle_mode&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Cycle mode (page does not exist)&quot;&gt;cycle mode&lt;/a&gt; to ‘end of loop’.  == Syntax ==  end.of.loop(&lt;a href=&quot;/index.php/Screen_object&quot; title=&quot;Screen object&quot;&gt;obj&lt;/a&gt; oA, &lt;a href=&quot;/index.php/Flag&quot; title=&quot;Flag&quot;&gt;flg&lt;/a&gt; fDONE);  == R...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The &amp;#039;&amp;#039;&amp;#039;end.of.loop&amp;#039;&amp;#039;&amp;#039; command switches an object&amp;#039;s [[cycle mode]] to &amp;amp;lsquo;end of loop&amp;amp;rsquo;.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&lt;br /&gt;
end.of.loop([[screen object|obj]] oA, [[flag|flg]] fDONE);&lt;br /&gt;
&lt;br /&gt;
== Remarks ==&lt;br /&gt;
&lt;br /&gt;
In &amp;amp;lsquo;end of loop&amp;amp;rsquo; [[cycle mode]], [[screen object]] &amp;#039;&amp;#039;&amp;#039;oA&amp;#039;&amp;#039;&amp;#039; will cycle one time, in the forward direction, until the end of the loop is reached.&lt;br /&gt;
&lt;br /&gt;
Setting the cycle mode to &amp;amp;lsquo;end of loop&amp;amp;rsquo; will automatically enable the object for [[updating]] if not currently enabled, and also enables the [[cycling property]].&lt;br /&gt;
&lt;br /&gt;
[[Flag]] &amp;#039;&amp;#039;&amp;#039;fDONE&amp;#039;&amp;#039;&amp;#039; is reset to FALSE when the command is executed. When the last [[cel]] is reached, &amp;#039;&amp;#039;&amp;#039;fDONE&amp;#039;&amp;#039;&amp;#039; is set to TRUE.&lt;br /&gt;
&lt;br /&gt;
Changing cycle mode does not change the current [[cel]]. The new cycle mode begins with whatever cel is currently assigned to the object. If the current cel is the last cel, no cycling will occur, as the object is already at the end of the loop. Flag &amp;#039;&amp;#039;&amp;#039;fDONE&amp;#039;&amp;#039;&amp;#039; will be set immediately.&lt;br /&gt;
&lt;br /&gt;
Use the &amp;#039;&amp;#039;&amp;#039;[[stop.cycling]]&amp;#039;&amp;#039;&amp;#039; command to turn cycling off. The &amp;#039;&amp;#039;&amp;#039;[[normal.cycle]]&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;[[reverse.cycle]]&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;[[reverse.loop]]&amp;#039;&amp;#039;&amp;#039; commands can be used to switch to other cycle modes.&lt;br /&gt;
&lt;br /&gt;
== Possible Errors ==&lt;br /&gt;
&lt;br /&gt;
AGI does not check that the [[screen object]] number oA is valid. If the object has not been [[initialized]] the &amp;#039;&amp;#039;&amp;#039;end.of.loop&amp;#039;&amp;#039;&amp;#039; command still sets the cycle mode to &amp;#039;end of loop&amp;#039; and resets the flag; nothing else will happen though. If the object number exceeds the [[maximum number of objects]], this command will overwrite other data on the [[memory heap]], which will cause unexpected results, including possibly [[crashing AGI]].&lt;br /&gt;
&lt;br /&gt;
Do not use &amp;#039;&amp;#039;&amp;#039;end.of.loop&amp;#039;&amp;#039;&amp;#039; and movement modes (&amp;#039;&amp;#039;&amp;#039;[[move.obj]]&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;[[follow.ego]]&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;[[wander]]&amp;#039;&amp;#039;&amp;#039;) one an object at the same time. The byte in the [[screen object data table]] that AGI uses to store the &amp;#039;&amp;#039;&amp;#039;fDONE&amp;#039;&amp;#039;&amp;#039; flag is also used by the movement modes. If you use a movement mode command while the &amp;#039;&amp;#039;&amp;#039;end.of.loop&amp;#039;&amp;#039;&amp;#039; command is active, the flag number gets overwritten, and when the object finishes cycling, the wrong flag will be set.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;CodeBlockHeader&amp;quot;&amp;gt;Code:&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;agi&amp;quot;&amp;gt;&lt;br /&gt;
#define door o7&lt;br /&gt;
...&lt;br /&gt;
[ initialize object&lt;br /&gt;
...&lt;br /&gt;
end.of.loop(door, f100);  [ open the door&lt;br /&gt;
if(isset(f100)) &lt;br /&gt;
  {&lt;br /&gt;
  print(&amp;quot;The door is open.&amp;quot;);&lt;br /&gt;
  reset(f100);&lt;br /&gt;
  }&lt;br /&gt;
...&lt;br /&gt;
reverse.loop(door, f99);  [ close the door&lt;br /&gt;
if(isset(f99)) &lt;br /&gt;
  {&lt;br /&gt;
  print(&amp;quot;The door is shut.&amp;quot;);&lt;br /&gt;
  reset(f99);&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Technical Information ==&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
| style=&amp;quot;background-color: #efefef&amp;quot; width=&amp;quot;200&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Required Interpreter Version:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
| width=&amp;quot;175&amp;quot; | Available in all AGI versions.&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background-color: #efefef&amp;quot; | &amp;#039;&amp;#039;&amp;#039;Byte-Code Value:&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
| 73 (0x49 hex)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[normal.cycle]]&amp;#039;&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[reverse.cycle]]&amp;#039;&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[reverse.loop]]&amp;#039;&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[stop.cycling]]&amp;#039;&amp;#039;&amp;#039;&amp;lt;br /&amp;gt;&lt;br /&gt;
[[Category:Commands]]&amp;lt;br /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Andrew Korson</name></author>
	</entry>
</feed>