Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local mon = peripheral.wrap("monitor_67")
- local pistons = "left"
- local chest = "back"
- -- the direction of which the receptacle is going from the chest, not the computer
- local receptacle = "right"
- --local books = {}
- books = {}
- local page = 1
- --Don't edit below here unless you know what you are doing :)
- local event
- local eventSide
- local eventX
- local eventY
- local skipRedstone = false
- function lsleep()
- sleep(2)
- end
- function touchDraw()
- event, eventSide, eventX, eventY = os.pullEvent("monitor_touch")
- end
- function renderMonitor()
- mon.clear()
- mon.setCursorPos(1,1)
- end
- function updateBooks()
- books = {}
- c = peripheral.wrap(chest)
- for book in pairs(c.getAllStacks()) do
- _book = {}
- stack = c.getStackInSlot(book)
- _book.name = stack.destination
- _book.slot = book
- books[#books + 1] = _book
- end
- end
- while (true) do
- updateBooks()
- if (skipRedstone == false) then
- redstone.setOutput(pistons, false)
- end
- skipRedstone = false
- returned = parallel.waitForAny(lsleep, touchDraw)
- if (returned == 2) then
- print("monitor touch")
- redstone.setOutput(pistons, true)
- skipRedstone = true
- else
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement