<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.visionaire-tracker.net/index.php?action=history&amp;feed=atom&amp;title=Dynamic_Loop_Handler_%28CMS%29</id>
		<title>Dynamic Loop Handler (CMS) - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.visionaire-tracker.net/index.php?action=history&amp;feed=atom&amp;title=Dynamic_Loop_Handler_%28CMS%29"/>
		<link rel="alternate" type="text/html" href="https://wiki.visionaire-tracker.net/index.php?title=Dynamic_Loop_Handler_(CMS)&amp;action=history"/>
		<updated>2026-05-05T05:50:23Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https://wiki.visionaire-tracker.net/index.php?title=Dynamic_Loop_Handler_(CMS)&amp;diff=3027&amp;oldid=prev</id>
		<title>AFRLme: Created page with &quot;''To do... - it works though!'' ;)   Working example... &lt;syntaxhighlight&gt; --[[ Dynamic Loop Handler [v2] (01/07/2014) Written by AFRLme [Lee Clarke] -- + -- alternatingfrequen...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.visionaire-tracker.net/index.php?title=Dynamic_Loop_Handler_(CMS)&amp;diff=3027&amp;oldid=prev"/>
				<updated>2014-08-14T14:22:48Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;#039;&amp;#039;To do... - it works though!&amp;#039;&amp;#039; ;)   Working example... &amp;lt;syntaxhighlight&amp;gt; --[[ Dynamic Loop Handler [v2] (01/07/2014) Written by AFRLme [Lee Clarke] -- + -- alternatingfrequen...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;''To do... - it works though!'' ;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Working example...&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
--[[&lt;br /&gt;
Dynamic Loop Handler [v2] (01/07/2014)&lt;br /&gt;
Written by AFRLme [Lee Clarke]&lt;br /&gt;
-- + --&lt;br /&gt;
alternatingfrequencies@hotmail.com | skype @ AFRLme&lt;br /&gt;
-- + --&lt;br /&gt;
This script is donation optional. In game credit is non-negotiable.&lt;br /&gt;
You are free to: ¹ use it in your game(s). ² modify the script.&lt;br /&gt;
Do not remove - or edit - this comment block.&lt;br /&gt;
--]]&lt;br /&gt;
&lt;br /&gt;
-- * tables * --&lt;br /&gt;
local t = {} -- create a new local table&lt;br /&gt;
t[&amp;quot;_temporary_&amp;quot;] = &amp;quot;&amp;quot; -- set table as temporary&lt;br /&gt;
&lt;br /&gt;
-- * function for creating a new loop * --&lt;br /&gt;
function addLoop(n, d, a)&lt;br /&gt;
 if table.maxn(t) &amp;gt; 0 and not checkLoopExists(n) or table.maxn(t) &amp;lt;= 0 then -- check if loop table is less than or more than 0 &amp;amp; if loop already exists&lt;br /&gt;
  table.insert(t, n); t[n] = {delay = d, amt = a, time = getTime()} -- create table &amp;amp; insert delay &amp;amp; amount values&lt;br /&gt;
  registerEventHandler(&amp;quot;mainLoop&amp;quot;, n) -- start the loop&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- * function for checking if loop already exists * --&lt;br /&gt;
function checkLoopExists(n)&lt;br /&gt;
 for i = 1, #(t) do if t[i] == n then return true elseif i == table.maxn(t) and t[i] ~= n then return false end end -- if loop exists return true else return false&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- * function used to kill the loop * --&lt;br /&gt;
function killLoop(n)&lt;br /&gt;
 for i = 1, #(t) do if t[i] == n then table.remove(t, i); break end end -- find the loop index value&lt;br /&gt;
 unregisterEventHandler(&amp;quot;mainLoop&amp;quot;, n) -- remove the loop data from the table&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- * function which determines if loop should be executed * --&lt;br /&gt;
function getLoopStatus(n)&lt;br /&gt;
 if getTime() &amp;gt;= t[n].time + t[n].delay then -- if current time is equal to or greater than previous time + delay&lt;br /&gt;
  if t[n].amt &amp;gt; 0 or t[n].amt == nil then -- if loop amount if greater than 0 or equal nil&lt;br /&gt;
   if t[n].amt ~= nil then t[n].amt = t[n].amt - 1 end -- if loop amount does not equal nil then loop amount - loop amount - 1&lt;br /&gt;
   t[n].time = getTime() -- update loop start time&lt;br /&gt;
   return true -- execute loop&lt;br /&gt;
  else killLoop(n); return false end -- end if 1&lt;br /&gt;
 else return false end -- end if 2&lt;br /&gt;
end -- end function&lt;br /&gt;
&lt;br /&gt;
function loop001()&lt;br /&gt;
 if getLoopStatus(&amp;quot;loop001&amp;quot;) then&lt;br /&gt;
  print(&amp;quot;001: &amp;quot; .. t.loop001.amt)&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function loop002()&lt;br /&gt;
 if getLoopStatus(&amp;quot;loop002&amp;quot;)  then&lt;br /&gt;
  print(&amp;quot;002: &amp;quot; .. t.loop002.amt)&lt;br /&gt;
 end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>AFRLme</name></author>	</entry>

	</feed>