1 posts
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?
3057 posts
Location
United States of America
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
1220 posts
Location
Earth orbit
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