Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local THIS_FLOOR = 1
- local modem = peripheral.wrap("front")
- local MONITORS = {"monitor_5", "monitor_6", "monitor_7", "monitor_8", "monitor_9"}
- local monitor = MONITORS[THIS_FLOOR]
- local activeFloor = 1
- modem.callRemote(monitor, "setBackgroundColor", colors.gray)
- modem.callRemote(monitor, "clear")
- function print(x, y, text)
- modem.callRemote(monitor, "setCursorPos", x, y)
- modem.callRemote(monitor, "write", text)
- end
- function color(color)
- modem.callRemote(monitor, "setBackgroundColor", color)
- end
- function setActiveFloor(floor)
- if (floor == THIS_FLOOR) then
- screenActive()
- redstone.setOutput("top", true)
- redstone.setOutput("right", true)
- else
- screenInactive()
- redstone.setOutput("top", false)
- redstone.setOutput("right", false)
- end
- activeFloor = floor
- end
- function screenInactive()
- local m = MONITORS[THIS_FLOOR]
- color(colors.black)
- modem.callRemote(monitor, "clear")
- print(1, 1, "-------")
- color(colors.gray)
- print(1, 4, " ")
- print(1, 5, "Tap to ")
- print(1, 6, " Call")
- print(1, 7, " ")
- color(colors.black)
- print(1, 12, "-------")
- end
- function screenActive()
- local m = MONITORS[THIS_FLOOR]
- color(colors.gray)
- modem.callRemote(monitor, "clear")
- color(colors.black)
- print(1, 2, " ")
- print(1, 3, " 3 ")
- color(colors.gray)
- print(1, 4, " ")
- print(1, 5, " 2 ")
- color(colors.black)
- print(1, 6, " ")
- print(1, 7, " 1 ")
- color(colors.gray)
- print(1, 8, " ")
- print(1, 9, " L ")
- color(colors.black)
- print(1, 10, " ")
- print(1, 11, " -1 ")
- end
- setActiveFloor(1)
- while true do
- local event, monitor, x, y = os.pullEvent("monitor_touch")
- floor = tonumber(string.sub(monitor, 9)) - 4
- if (floor ~= activeFloor) then
- setActiveFloor(floor)
- else
- floor = math.floor((13 - y) / 2)
- if (floor > 0 and floor <= 5) then
- setActiveFloor(floor)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement