Advertisement
Guest User

CountDown

a guest
Mar 31st, 2015
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.90 KB | None | 0 0
  1. h = 0
  2. m = 0
  3. s = 30
  4. mon = peripheral.wrap("front")
  5.  
  6. function Depart()
  7.  
  8.   if h ==0 and m == 0 and s == 0 then
  9.     term.clear()
  10.     term.setCursorPos(1,1)
  11.     redstone.setOutput("left", true)
  12.     print("Train is Departing")
  13.     sleep(5)
  14.     term.clear()
  15.     term.setCursorPos(1,1)
  16.     redstone.setOutput("left", false)
  17.     print("Waiting for the next Train")
  18.     sleep(66)
  19.     h = 0
  20.     m = 9
  21.     s = 59
  22.   end
  23. end
  24.  
  25. function Check()
  26.  
  27.   if s <= -1 then
  28.     m = m -1
  29.     s = 59
  30.   end
  31.  
  32.   if m < 0 then
  33.     h = h -1
  34.     m = 60
  35.   end
  36.  
  37.   if redstone.getInput("right", true) then
  38.     h = 0
  39.     m = 0
  40.     s = 0
  41.   end
  42.  
  43.   Depart()
  44.  
  45. end
  46.  
  47. while true do
  48.   term.redirect(peripheral.wrap("front"))
  49.   mon.setTextScale(4)
  50.   term.clear()
  51.   term.setCursorPos(1,1)
  52.  
  53.   print("Train Will Depart In:")
  54.   mon.setCursorPos(6,4)
  55.   print(m..":"..s)
  56.   sleep(1)
  57.   s = s-1
  58.   Check()
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement