Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. local cableSide = "top"
  2.  
  3. local mon = peripheral.wrap("right")
  4. mon.setTextColor(colours.white)
  5. mon.setBackgroundColor(colours.black)
  6. mon.clear()
  7.  
  8. local xLen, yLen = mon.getSize()
  9.  
  10. local myEvent
  11.  
  12. local switches = {
  13. ["Retractable Ceiling"] = {colour = colours.white, screenRow = 5},
  14.  
  15. for key,value in pairs(switches) do
  16. mon.setBackgroundColor(colours.black)
  17. mon.setCursorPos(2,value.screenRow)
  18. mon.write(key)
  19. mon.setCursorPos(xLen-5,value.screenRow)
  20.  
  21. if colours.test(rs.getBundledOutput(cableSide),value.colour) then
  22. mon.setBackgroundColor(colours.green)
  23. mon.write(" On ")
  24. else
  25. mon.setBackgroundColor(colours.red)
  26. mon.write(" Off ")
  27. end
  28. end
  29.  
  30. while true do
  31. myEvent = {os.pullEvent("monitor_touch")}
  32.  
  33. for key,value in pairs(switches) do if myEvent[4] == value.screenRow then
  34. mon.setCursorPos(xLen-5,value.screenRow)
  35.  
  36. if not colours.test(rs.getBundledOutput(cableSide),value.colour) then
  37. mon.setBackgroundColor(colours.green)
  38. mon.write(" On ")
  39. rs.setBundledOutput(cableSide,colours.combine(rs.getBundledOutput(cableSide),value.colour))
  40. else
  41. mon.setBackgroundColor(colours.red)
  42. mon.write(" Off ")
  43. rs.setBundledOutput(cableSide,colours.subtract(rs.getBundledOutput(cableSide),value.colour))
  44. end
  45.  
  46. break
  47. end end
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement