Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- monitor=peripheral.wrap("front")
- mouseWidth = 0
- mouseHeight = 0
- function prepare()
- monitor.clear()
- monitor.setBackgroundColor((colors.black))
- monitor.setCursorPos(1,1)
- monitor.setTextColor((colors.white))
- monitor.write("water")
- monitor.setCursorPos(1,2)
- monitor.write("cooling")
- end
- function on()
- prepare()
- monitor.setCursorPos(2,4)
- monitor.setBackgroundColor((colors.green))
- monitor.write(" on ")
- end
- function off()
- prepare()
- monitor.setCursorPos(2,4)
- monitor.setBackgroundColor((colors.red))
- monitor.write(" off ")
- end
- function ClickOn()
- if mouseWidth > 1 and mouseWidth < 9 and mouseHeight == 4 then
- rs.setOutput("back", false)
- end
- end
- function ClickOff()
- if mouseWidth > 1 and mouseWidth < 9 and mouseHeight == 4 then
- rs.setOutput("back", true)
- end
- end
- function checkOff()
- event,p1,p2,p3 = os.pullEvent()
- if event == "monitor_touch" then
- mouseWidth = p2
- mouseHeight = p3
- ClickOff()
- return "aan"
- end
- end
- function checkOn()
- event,p1,p2,p3 = os.pullEvent()
- if event == "monitor_touch" then
- mouseWidth = p2
- mouseHeight = p3
- ClickOn()
- return "aan"
- end
- end
- while true do
- prepare()
- off()
- repeat
- checkOff()
- until
- checkOff() == "aan"
- prepare()
- on()
- repeat
- checkOn()
- until
- checkOn() == "aan"
- end
Advertisement
Add Comment
Please, Sign In to add comment