FBA The Creator
http://www.fbacreator.com/fbaforum/

Countdown Timer
http://www.fbacreator.com/fbaforum/viewtopic.php?f=10&t=65
Page 1 of 1

Author:  phrebh [ Thu Jun 26, 2008 8:03 pm ]
Post subject:  Countdown Timer

This small code is just a proof-of-concept for creating a timer in FBA. As written, it counts down from ten and closes the program when it reaches 0. This provides the basis for all sorts of timers and will hopefully be of some help to someone.

Code:
local startCount=10
local now=clock()
local count=startCount

function onmainloop()
  clear(0,0,0)
  count=startCount-math.floor((clock()-now)/1000)
  if count<=0 then quit() end
  print(50,50,count,255,255,0)
end

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/