Ranger Fox Posted January 30, 2008 Share Posted January 30, 2008 I want to display how much time is remaining on a timer. Let's say the timer's name is "Timer", such that the Lua code's object name is "ztimerTimer". I looked at the following web site: http://www.evilmana.com/tutorials/lua_tutorial_11.php I have tried the following and everything failed: ztimerTimer:time() ztimerTimer.time ztimerTimer.time() ztimerTimer:Time() ztimerTimer:Time Is Groundspeak encapsulating the timer? For those interested, I'm giving the user a stopwatch item that will show the time remaining. I have a second timer firing at an interval of five seconds. On each tick, the following code will be executed such that the stopwatch item's description will display the timer's seconds remaining: zitemStopwatch.Description = ztimerTimer:time() .. " seconds left" Quote Link to comment
+davidloew Posted January 31, 2008 Share Posted January 31, 2008 (edited) I want to display how much time is remaining on a timer. Let's say the timer's name is "Timer", such that the Lua code's object name is "ztimerTimer". I looked at the following web site: http://www.evilmana.com/tutorials/lua_tutorial_11.php I have tried the following and everything failed: ztimerTimer:time() ztimerTimer.time ztimerTimer.time() ztimerTimer:Time() ztimerTimer:Time Is Groundspeak encapsulating the timer? For those interested, I'm giving the user a stopwatch item that will show the time remaining. I have a second timer firing at an interval of five seconds. On each tick, the following code will be executed such that the stopwatch item's description will display the timer's seconds remaining: zitemStopwatch.Description = ztimerTimer:time() .. " seconds left" Yes for the timer, we are encapsulating it. Part of the reason is to track the timer if the user turns off the device and the other part is because we don't have the luxury on the Garmin device to access system stuff. You could keep your own variable and track the time that way. We could in the future, provide those kinds of attributes for it though. David. Edited January 31, 2008 by davidloew Quote Link to comment
Ranger Fox Posted January 31, 2008 Author Share Posted January 31, 2008 Yes, I think a feature like that might be sensible to include in a future release. Many games utilizing countdown timers as part of its story could certainly use the feature of displaying remaining time to a player. Quote Link to comment
Ranger Fox Posted January 31, 2008 Author Share Posted January 31, 2008 Yes, I think a feature like that might be sensible to include in a future release. Many games utilizing countdown timers as part of its story could certainly use the feature of displaying remaining time to a player. Quote Link to comment
+davidloew Posted January 31, 2008 Share Posted January 31, 2008 Yes, I think a feature like that might be sensible to include in a future release. Many games utilizing countdown timers as part of its story could certainly use the feature of displaying remaining time to a player. I was thinking about this and you could use the os.date and os.time features or simply a numeric seconds variable. Then, when the timer tick occurs, decrement the seconds variable. And, with the SetStatusText that is implemented on the ppc, you could display the seconds countdown. Looking at the link you sent, I believe that is a PSP implemented timer just like our Wherigo Timer. The lua system has no timer built in. I may create a sample so see what it looks like. David Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.