Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- term.setCursorPos(1,1)
- print("Touch screen door made by Rin")
- local mon = peripheral.wrap("top")
- local function initial()
- mon.clear()
- mon.setCursorPos(1,1)
- mon.setTextScale(2)
- mon.setBackgroundColor(colors.lime)
- mon.write("open")
- mon.setCursorPos(1,2)
- mon.write(" ")
- end
- local maxcount = 3
- local function count()
- for x = maxcount, 1, -1 do
- mon.setCursorPos(2,2)
- mon.clearLine()
- mon.write(x.."s")
- sleep(1)
- end
- mon.clearLine()
- end
- local mw = 0
- local mh = 0
- local function clickSpace()
- if mw > 0 and 5 and mh > 0 and mh < 3 then
- mon.setCursorPos(1,1)
- mon.setBackgroundColor(colors.red)
- mon.write("open")
- rs.setOutput("left", true)
- count()
- rs.setOutput("left", false)
- end
- initial()
- end
- initial()
- while true do
- local event, side, xPos, yPos = os.pullEvent("monitor_touch")
- mw = xPos
- mh = yPos
- clickSpace()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement