Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local cableSide = "top"
- local mon = peripheral.wrap("right")
- mon.setTextColor(colours.white)
- mon.setBackgroundColor(colours.black)
- mon.clear()
- local xLen, yLen = mon.getSize()
- local myEvent
- local switches = {
- ["Retractable Ceiling"] = {colour = colours.white, screenRow = 5},
- for key,value in pairs(switches) do
- mon.setBackgroundColor(colours.black)
- mon.setCursorPos(2,value.screenRow)
- mon.write(key)
- mon.setCursorPos(xLen-5,value.screenRow)
- if colours.test(rs.getBundledOutput(cableSide),value.colour) then
- mon.setBackgroundColor(colours.green)
- mon.write(" On ")
- else
- mon.setBackgroundColor(colours.red)
- mon.write(" Off ")
- end
- end
- while true do
- myEvent = {os.pullEvent("monitor_touch")}
- for key,value in pairs(switches) do if myEvent[4] == value.screenRow then
- mon.setCursorPos(xLen-5,value.screenRow)
- if not colours.test(rs.getBundledOutput(cableSide),value.colour) then
- mon.setBackgroundColor(colours.green)
- mon.write(" On ")
- rs.setBundledOutput(cableSide,colours.combine(rs.getBundledOutput(cableSide),value.colour))
- else
- mon.setBackgroundColor(colours.red)
- mon.write(" Off ")
- rs.setBundledOutput(cableSide,colours.subtract(rs.getBundledOutput(cableSide),value.colour))
- end
- break
- end end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement