Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mouseWidth = 0
- mouseHeight = 0
- monitor = peripheral.wrap("right")
- monitor.clear()
- monitor.setCursorPos(1,1)
- w,h=monitor.getSize()
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(2,2)
- monitor.write(" ON ")
- monitor.setBackgroundColor((colors.red))
- monitor.setCursorPos(2,4)
- monitor.write(" OFF ")
- monitor.setBackgroundColour((colours.black))
- function checkClickPosition()
- if mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 2 then
- rs.setOutput("right",true)
- elseif mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 4 then
- rs.setOutput("right",false)
- end
- repeat
- event,p1,p2,p3 = os.pullEvent()
- if event=="monitor_touch" then
- mouseWidth = p2
- mouseHeight = p3
- checkClickPosition()
- end
- until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement