Operating system for OpenComputers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
574B

  1. local lastkey = computer.uptime()
  2. local state = true
  3. local delay = 60
  4. function start()
  5. return os.spawn(function()
  6. while true do
  7. tEv = {coroutine.yield()}
  8. if tEv[1] == "key_down" then
  9. lastkey = computer.uptime()
  10. if not state then
  11. for addr in component.list("screen") do
  12. component.invoke(addr,"turnOn")
  13. end
  14. state = true
  15. end
  16. end
  17. if computer.uptime() > lastkey + delay and state then
  18. for addr in component.list("screen") do
  19. component.invoke(addr,"turnOff")
  20. end
  21. state = false
  22. end
  23. end
  24. end,"screenblank")
  25. end