Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- modemSide = "back"
- targetID = 4190
- local monitor = peripheral.wrap("front")
- local function drawBar()
- local w, h = monitor.getSize()
- term.redirect(monitor)
- monitor.setBackgroundColor(colors.blue)
- monitor.clear()
- monitor.setTextColor(colors.white)
- paintutils.drawLine(2, 2, 3, 2, colors.red)
- monitor.setBackgroundColor(colors.blue)
- monitor.setCursorPos(5, 2)
- monitor.write("[Door Control]")
- paintutils.drawLine(22, 3, 22, 5, colors.red)
- monitor.setCursorPos(3, 4)
- monitor.setBackgroundColor(colors.green)
- monitor.write("[Open]")
- monitor.setCursorPos(10, 4)
- monitor.setBackgroundColor(colors.red)
- monitor.write("[Close]")
- end
- drawBar()
- while true do
- local event, side, x, y = os.pullEvent("monitor_touch")
- monitor.setBackgroundColor(colors.gray)
- if x >= 3 and x <= 7 and y == 4 then
- rednet.open(modemSide)
- rednet.send(targetID, "open")
- rednet.close(modemSide)
- elseif x >= 10 and x <= 17 and y == 4 then
- rednet.open(modemSide)
- rednet.send(targetID, "close")
- rednet.close(modemSide)
- end
- drawBar()
- os.sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement