Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --name Enchanter
- --version 1.0
- version = "1.0a"
- local side = {}
- side.enchanter = 0
- side.books = 5
- side.enBooks = 1
- local bookId = 340
- local bookCount
- local enchanter
- local enBookId
- local loopTime = 0.1
- sorter = peripheral.wrap("back")
- while true do
- local x = sorter.list(side.books)
- if x == nil then
- bookCount = -1
- else
- bookCount = 0
- for id,cnt in pairs(x) do
- if id == bookId then
- bookCount = cnt
- end
- end
- end
- x = sorter.list(side.enchanter)
- if x == nil then
- enchanter = -1
- else
- enchanter = 0
- for id,cnt in pairs(x) do
- if id == bookId then
- enchanter = 1
- else
- enchanter = 2
- enBookId = id
- end
- end
- end
- x = sorter.list(side.enBooks)
- if x == nil then
- enBooks = -1
- else
- enBooks = 1
- end
- term.clear()
- term.setCursorPos(1,1)
- print("Enchanter (v", version, ")")
- print("------------------------\n")
- print("| Blank books: " .. ((bookCount == -1) and "Not connected" or tostring(bookCount)))
- write("| Enchanter: ")
- if (enchanter == -1) then
- print("Not connected.")
- elseif (enchanter == 0) then
- print("Empty")
- sorter.extract(side.books, bookId, side.enchanter, 1)
- elseif (enchanter == 1) then
- print("Ready")
- elseif (enchanter == 2) then
- print("Done")
- sorter.extract(side.enchanter, enBookId, 1, 1)
- end
- os.sleep(loopTime)
- end
Advertisement
Add Comment
Please, Sign In to add comment