Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monitor = peripheral.wrap("front")
- local function drawBar()
- monitor.clear()
- local w, h = monitor.getSize()
- term.redirect(monitor)
- paintutils.drawFilledBox(1,1,8,7,colors.green)
- paintutils.drawFilledBox(8,7,10,14,colors.red)
- paintutils.drawLine(9,1,9,10, colors.gray)
- monitor.setCursorPos(2,3)
- monitor.setBackgroundColor(colors.green)
- monitor.setTextColor(colors.white)
- monitor.write("[Open]")
- monitor.setCursorPos(11,3)
- monitor.setBackgroundColor(colors.red)
- monitor.setTextColor(colors.white)
- monitor.write("[Close]")
- end
- drawBar()
- while true do
- local event, side, x, y = os.pullEvent("monitor_touch")
- if x >= 2 and x <= 6 and y == 3 then
- monitor.clear()
- monitor.setTextColor(colors.white)
- monitor.setCursorPos(2,3)
- monitor.write("Door is open")
- monitor.setCursorPos(2,4)
- monitor.write("Please wait")
- ---------------------------------
- --place redstone code
- -----------------------------------
- elseif x >= 11 and x <= 14 and y == 3 then
- monitor.clear()
- monitor.setTextColor(colors.white)
- monitor.setCursorPos(2,3)
- monitor.write("Door is close")
- monitor.setCursorPos(2,4)
- monitor.write("Please wait")
- ---------------------------------
- --place redstone code
- -----------------------------------
- end
- drawBar()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement