Guest User

Startup

a guest
May 20th, 2015
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.49 KB | None | 0 0
  1. local s = peripheral.wrap('speaker_2')
  2. local mc = peripheral.wrap('monitor_2')
  3. local ml = peripheral.wrap('monitor_1')
  4. local mr = peripheral.wrap('monitor_0')
  5. local tl = peripheral.wrap('BigReactors-Turbine_0')
  6. local tr = peripheral.wrap('BigReactors-Turbine_1')
  7.  
  8. -- These two peripherals aren't used yet?
  9. local nb = peripheral.wrap('noteBlock_0')
  10. local cb = peripheral.wrap('chatBox_1')
  11.  
  12. mc.setTextColor(32768)
  13. mc.setBackgroundColor(colors.green)
  14. mc.setTextScale(3)
  15.  
  16. tl.setActive(false)
  17. ml.setBackgroundColor(colors.red)
  18. ml.clear()
  19.  
  20. tr.setActive(false)
  21. mr.setBackgroundColor(colors.red)
  22. mr.clear()
  23.  
  24. local function off()
  25.         mc.setBackgroundColor(colors.red)
  26.         mc.clear()
  27.         ml.setBackgroundColor(colors.red)
  28.         ml.clear()
  29.         mr.setBackgroundColor(colors.red)
  30.         mr.clear()
  31. end
  32.  
  33. s.speak("System Engaged")
  34.  
  35. while true do
  36.         mc.clear()
  37.         mc.setCursorPos(1,1)
  38.         if rs.getInput("left") then mc.write("Sealed") else mc.write("Unsealed") end
  39.        
  40.         write("Enter command (? for help): ")
  41.         local input = io.read():lower()  -- Convert the result of the read command to lowercase to make matching simpler.
  42.        
  43.         if input == "restart" then
  44.                 s.speak("restarting")
  45.                 off()
  46.                 sleep(5)
  47.                 os.reboot()
  48.         elseif input == "shutdown" then
  49.                 s.speak("Shutting Down")
  50.                 off()
  51.                 sleep(0)
  52.                 break
  53.         elseif input == "startup left" then
  54.                 ml.setBackgroundColor(colors.green)
  55.                 ml.clear()
  56.                 tl.setActive(true)
  57.         elseif input == "startup right" then
  58.   mr.setBackgroundColor(colors.green)
  59.                 mr.clear()
  60.                 tr.setActive(true)
  61.         elseif input == "shutoff left" then
  62.                 ml.setBackgroundColor(colors.red)
  63.                 ml.clear()
  64.                 tl.setActive(false)
  65.         elseif input == "shutoff right" then
  66.                 mr.setBackgroundColor(colors.red)
  67.                 mr.clear()
  68.                 tr.setActive(false)
  69.         elseif input == "?" then
  70.                 print()
  71.                 print("Commands")
  72.                 print()
  73.                 print("?")
  74.                 print("Shutdown")
  75.                 print("Restart")
  76.                 print("Startup Left")
  77.                 print("Startup Right")
  78.                 print("Shutoff Left")
  79.                 print("Shutoff Right")
  80.         end
  81. end
Advertisement
Add Comment
Please, Sign In to add comment