Advertisement
Guest User

Untitled

a guest
May 5th, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local Rooms = {"Elevator","Hallway"}
  2. table.insert(Rooms,#Rooms + 1,"SHUTDOWN")
  3. table.insert(Rooms,#Rooms + 1,"ON")
  4. local activL = {}
  5. local activO = {}
  6. local mon = peripheral.wrap("top")
  7. local add = true
  8. local lockdown = false
  9. mon.clear()
  10. local highlighted = 1
  11.  
  12. for i=1,#Rooms,1 do
  13.     table.insert(activL,"1")
  14.     table.insert(activO,"1")
  15. end
  16. term.redirect(peripheral.wrap("top"))
  17. mon.setBackgroundColor(colors.black)
  18. mon.clear()
  19. mon.setBackgroundColor(colors.black)
  20. paintutils.drawFilledBox(1,38,6,40,colors.red)
  21. mon.setBackgroundColor(colors.black)
  22.  
  23. while true do
  24. mon.setBackgroundColor(colors.black)
  25. mon.clear()
  26. if lockdown == false then
  27.     paintutils.drawFilledBox(1,38,6,40,colors.red)
  28.     mon.setBackgroundColor(colors.black)
  29. else
  30.     paintutils.drawFilledBox(1,38,6,40,colors.purple)
  31.     mon.setBackgroundColor(colors.black)
  32. end
  33.     mon.setCursorPos(1,1)
  34.     if lockdown == false then
  35.         mon.write("Lights:")
  36.     else
  37.         mon.write("Lock Down: ")
  38.     end
  39.     local x = 2
  40.     local a = 1
  41.     for i = 1,#Rooms,1 do
  42.         mon.setCursorPos(a,x)
  43.         x = x + 1
  44.         if activL[i] == "1" and lockdown == false then
  45.             mon.setTextColor(colors.green)
  46.         elseif activL[i] == "0" and lockdown == false then
  47.             mon.setTextColor(colors.red)
  48.         elseif activO[i] == "1" and lockdown == true then
  49.             mon.setTextColor(colors.green)
  50.         elseif activO[i] == "0" and lockdown == true then
  51.             mon.setTextColor(colors.red)
  52.         end
  53.         if highlighted == i then
  54.             mon.write("> "..Rooms[i].." ")
  55.         else
  56.             mon.write("  "..Rooms[i].." ")
  57.         end
  58.         mon.setTextColor(colors.white)
  59.     end
  60.     if activL[highlighted] == "1" then
  61.         paintutils.drawFilledBox(25,38,30,40,colors.green)
  62.     else
  63.         paintutils.drawFilledBox(25,38,30,40,colors.red)
  64.     end
  65.     local event, side, x, y = os.pullEvent()
  66.     if event == "monitor_touch" then
  67.         if x > 25 and y > 38 then
  68.             if activL[highlighted] == "0" and lockdown == false then
  69.                 table.remove(activL,highlighted)
  70.                 table.insert(activL,highlighted,"1")
  71.             elseif activL[highlighted] == "1" and lockdown == false then
  72.                 table.remove(activL,highlighted)
  73.                 table.insert(activL,highlighted,"0")
  74.             elseif activO[highlighted] == "0" and lockdown == true then
  75.                 table.remove(activO,highlighted)
  76.                 table.insert(activO,highlighted,"1")
  77.             elseif activO[highlighted] == "1" and lockdown == true then
  78.                 table.remove(activO,highlighted)
  79.                 table.insert(activO,highlighted,"0")
  80.             end
  81.             if highlighted == #Rooms - 1 then
  82.                 activL = {}
  83.                 for i = 1,#Rooms,1 do
  84.                     table.insert(activL,"0")
  85.                 end
  86.             end
  87.             if highlighted == #Rooms then
  88.                 os.reboot()
  89.             end
  90.         elseif x > 1 and x < 6 and y >38 and y < 41 then
  91.             if lockdown == true then
  92.                 lockdown = false
  93.             else
  94.                 lockdown = true
  95.             end
  96.         else
  97.             highlighted = highlighted + 1
  98.             if highlighted > #Rooms then
  99.                 highlighted = 1
  100.             end
  101.         end
  102.     end
  103. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement