Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("touchpoint")
- local t = touchpoint.new("back")
- function doorOpen()
- rs.setBundledOutput("right", colors.red)
- sleep(0.15)
- rs.setBundledOutput("right", 0)
- door = "open"
- end
- function doorClose()
- rs.setBundledOutput("right", colors.green)
- sleep(0.15)
- rs.setBundledOutput("right", colors.combine(colors.green, colors.red))
- door = "closed"
- end
- doorClose()
- doorOpen()
- t:add ("open", nil, 1, 1, 9, 5, colors.lime, colors.blue)
- t:add ("close", nil, 10, 1, 18, 5, colors.red, colors.blue)
- t:draw()
- while true do
- local event, p1 = t:handleEvents(os.pullEvent())
- if event == "button_click" then
- t:flash(p1)
- if p1 == "open" and door == "closed" then
- doorOpen()
- elseif p1 == "close" and door == "open" then
- doorClose()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement