Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("bottom")
- mouseWidth = 0
- mouseHeight = 0
- monitor = peripheral.wrap("top")
- monitor.clear()
- monitor.setCursorPos(1,1)
- w,h=monitor.getSize()
- print(w)
- print(h)
- --Building Interface
- monitor.setBackgroundColour((colours.lime))
- monitor.setCursorPos(2,2)
- monitor.write(" ON ")
- monitor.setCursorPos(2,4)
- monitor.write(" OFF ")
- monitor.setBackgroundColour((colours.black))
- --Functions (2)
- function checkClickPosition()
- if mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 2 then
- rednet.send(259,"EXPerienceBeginCycle", true)
- rednet.send(260,"EXPerienceBeginCycle", true)
- elseif mouseWidth > 1 and mouseWidth < 8 and mouseHeight == 4 then
- rednet.send(260,"EXPerienceEndCycle", true)
- sleep(30)
- rednet.send(269,"EXPerienceEndCycle", true)
- end
- end
- function ToggleBook()
- if rs.getInput("back")==true then
- rs.setOutput("back", false)
- else
- rs.setOutput("back",true)
- end
- end
- repeat
- event,p1,p2,p3 = os.pullEvent()
- if event=="monitor_touch" then
- mouseWidth = p2
- mouseHeight = p3
- checkClickPosition()
- elseif event=="redstone" then
- ToggleBook()
- sleep(3)
- end
- until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement