Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mouseWidth = 0
- mouseHeight = 0
- monitor = peripheral.wrap("top")
- monitor.clear()
- monitor.setCursorPos(1,1)
- w,h=monitor.getSize()
- print(w)
- print(h)
- -- this can be any color in the computercraft color api
- monitor.setBackgroundColour((colors.red))
- monitor.setCursorPos(2,2)
- monitor.write("open ")
- monitor.setCursorPos(2,4)
- monitor.write("close")
- --this can be any color in the computercraft color api
- monitor.setBackgroundColour((colors.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
- 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