Advertisement
VGToolBox

Bedroom Clock

Sep 17th, 2012
1,023
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. mon = peripheral.wrap("back")
  2. bedTime = false
  3. mon.setTextScale(3)
  4. term.redirect(mon)
  5.  
  6. while true do
  7. mon.clear()
  8. mon.setCursorPos(1,1)
  9. --write(os.time())
  10. write(textutils.formatTime(os.time(),true))
  11. sleep(1)
  12.  
  13. if os.time() > 19 and not bedTime then
  14.   rs.setBundledOutput("bottom",0)
  15.   sleep(1)
  16.   for i = 1, 2 do
  17.   rs.setBundledOutput("bottom", colours.combine(rs.getBundledOutput("bottom"), colours.black))
  18.   sleep(1)
  19.   rs.setBundledOutput("bottom",colours.subtract(rs.getBundledOutput("bottom"), colours.black))
  20.   sleep(1)  
  21.   end
  22.   bedTime = true
  23. elseif os.time() > 6 and os.time() < 19 and bedTime then
  24.   for i = 1, 2 do
  25.   rs.setBundledOutput("bottom",colours.combine(rs.getBundledOutput("bottom"), colours.lightBlue))
  26.   sleep(1)
  27.   rs.setBundledOutput("bottom",0)
  28.   sleep(1)
  29.   end
  30.   rs.setBundledOutput("bottom",colours.orange)
  31.   bedTime = false
  32. elseif os.time() > 6 and os.time() < 19 and not colours.test(rs.getBundledOutput("bottom"), colours.orange) then
  33.   bedTime = false
  34.   rs.setBundledOutput("bottom",colours.orange)
  35. end
  36.  
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement