This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
SoMuchWessel's profile picture

Digital Countdown (Request)

Started by SoMuchWessel, 17 December 2017 - 11:02 AM
SoMuchWessel #1
Posted 17 December 2017 - 12:02 PM
Hi guys,

I want a program that i can set the amout of time for the countdown, and if i hit enter that it will display a countdown on a monitor.

Can you guys help me out?
KingofGamesYami #2
Posted 18 December 2017 - 12:11 AM

write( "Enter countdown: " )
local nCount = tonumber(read())
local mon = peripheral.find("monitor")
for i = nCount, 0, -1 do
  mon.clear()
  mon.setCursorPos(1,1)
  mon.write( i )
  sleep( 1 )
end
Edited on 17 December 2017 - 11:12 PM
Dog #3
Posted 18 December 2017 - 12:17 AM
KoGY's script pretty much sums it up.

If you want something a little fancier (multiple monitor support, multiple monitor size support, displays tenths of seconds, allows you input hours/minutes/seconds) I wrote a slightly more complex version awhile back - feel free to make use of it. Install on a computer or turtle and connect one or more monitors - monitors don't have to be the same size either, the script will determine the best text scale for each monitor connected.

pastebin get RLnPen2x timer

The script is pretty straight forward - when run it will ask you to input the hours, then minutes, then seconds, then it'll count down and exit upon reaching zero.
Edited on 17 December 2017 - 11:41 PM