Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- modemSide = "back"
- targetID = 4361
- local monitor = peripheral.wrap("right")
- 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, 5, 2, colors.red)
- monitor.setBackgroundColor(colors.blue)
- monitor.setCursorPos(6, 2)
- monitor.write("[Rocket Gate]")
- paintutils.drawLine(22, 3, 22, 5, colors.red)
- paintutils.drawLine(23, 3, 23, 5, colors.red)
- paintutils.drawLine(21, 3, 21, 5, colors.red)
- paintutils.drawPixel(20, 6, colors.red)
- paintutils.drawPixel(19, 7, colors.red)
- paintutils.drawPixel(24, 6, colors.red)
- paintutils.drawPixel(25, 7, colors.red)
- paintutils.drawPixel(22, 2, colors.red)
- paintutils.drawPixel(22, 4, colors.white)
- monitor.setCursorPos(3, 5)
- monitor.setBackgroundColor(colors.green)
- monitor.write("[Open]")
- monitor.setCursorPos(10, 5)
- 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 == 5 then
- rednet.open(modemSide)
- rednet.send(targetID, "open")
- rednet.close(modemSide)
- elseif x >= 10 and x <= 17 and y == 5 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