<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Maratis forum - Timer in lua]]></title>
	<link rel="self" href="http://forum.maratis3d.com/extern.php?action=feed&amp;tid=462&amp;type=atom"/>
	<updated>2012-10-22T09:23:36Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.maratis3d.com/viewtopic.php?id=462</id>
		<entry>
			<title type="html"><![CDATA[Re: Timer in lua]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=2805#p2805"/>
			<content type="html"><![CDATA[<p>Okay good, thanks.</p>]]></content>
			<author>
				<name><![CDATA[Almighty Laxz]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1037</uri>
			</author>
			<updated>2012-10-22T09:23:36Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=2805#p2805</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Timer in lua]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=2803#p2803"/>
			<content type="html"><![CDATA[<p>onSceneUpdate is always launched 60 time per second, even if the fps are lower. so it&#039;s safe.</p>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2012-10-22T06:38:32Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=2803#p2803</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Timer in lua]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=2801#p2801"/>
			<content type="html"><![CDATA[<p>Thanks! But if the fps was lower than 60 wouldn&#039;t the timer be inaccurate?</p>]]></content>
			<author>
				<name><![CDATA[Almighty Laxz]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1037</uri>
			</author>
			<updated>2012-10-21T21:48:46Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=2801#p2801</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Timer in lua]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=2797#p2797"/>
			<content type="html"><![CDATA[<p>Hello, to quote anael : <br /></p><div class="quotebox"><cite>anael wrote:</cite><blockquote><p>The lua script update is syncronised at 60fps<br />so you can create a timer with a simple variable like that :</p><p>t = 0</p><p>function onSceneUpdate()</p><p>&nbsp; &nbsp; -- 1 second<br />&nbsp; &nbsp; if t == 60&nbsp; then<br />&nbsp; &nbsp; &nbsp; &nbsp; print(&quot;one second&quot;)<br />&nbsp; &nbsp; end</p><p>&nbsp; &nbsp; t = t+1<br />end</p></blockquote></div><p>So you could do something like :<br />--print every seconds in the console</p><p>TIMER = {ms = 0,&nbsp; seconds = 0, onesec = 60}</p><p>function onSceneUpdate() </p><p>&nbsp; &nbsp; TIMER.ms = TIMER.ms + 1</p><p>&nbsp; &nbsp; if TIMER.ms == TIMER.onesec then <br />&nbsp; &nbsp; &nbsp; &nbsp; TIMER.ms = 0 <br />&nbsp; &nbsp; &nbsp; &nbsp; TIMER.seconds = TIMER.seconds + 1<br />&nbsp; &nbsp; &nbsp; &nbsp; print(TIMER.seconds)<br />&nbsp; &nbsp; end</p><p>end</p>]]></content>
			<author>
				<name><![CDATA[Vegas]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=53</uri>
			</author>
			<updated>2012-10-21T11:30:22Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=2797#p2797</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Timer in lua]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=2796#p2796"/>
			<content type="html"><![CDATA[<p>Hi,<br />I am currently making time challenges for my game, but I don&#039;t know how to make a timer to count the seconds. Does anyone know how?</p>]]></content>
			<author>
				<name><![CDATA[Almighty Laxz]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1037</uri>
			</author>
			<updated>2012-10-21T07:33:24Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=2796#p2796</id>
		</entry>
</feed>
