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)
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(2,2)
- monitor.write(" ON ")
- monitor.setCursorPos(2,4)
- monitor.write(" OFF ")
- monitor.setBackgroundColour((colours.black))
- function checkClickPosition()
- if mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 2 then
- -- button one clicked
- rs.setOutput("right",true)
- -- turns redstone connected to the right on
- elseif mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 4 then
- -- button two clicked
- rs.setOutput("right",false)
- -- turns redstone connected to the left off
- end -- ends the if loop
- end -- ends the function
- repeat
- event,p1,p2,p3 = os.pullEvent()
- if event=="monitor_touch" then
- mouseWidth = p2 -- sets mouseWidth
- mouseHeight = p3 -- and mouseHeight
- checkClickPosition() -- this runs our function
- end
- until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement