Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local chestZide = "right"
- local monitor = peripheral.wrap("top")
- local chestLoc = peripheral.wrap(chestZide)
- local portalLoc = peripheral.wrap("back")
- monitor.setTextScale(1)
- portalLoc.pushItem("north",1,64,1)
- for i = 1, 16 do chestLoc.pullItem("west",i,64) end
- sleep(1)
- local chest = peripheral.call(chestZide, "getAllStacks")
- local chestInvSize = peripheral.call(chestZide, "getInventorySize")
- print("invSize: "..chestInvSize)
- local allBooks = {}
- local bookid = 0
- for i = 1, chestInvSize do
- if chest[i] ~= nil then
- if chest[i]["id"] == 8957 then
- bookid = bookid + 1
- allBooks[bookid] = {"name","slot","actief"}
- allBooks[bookid]["name"] = chest[i]["name"]
- allBooks[bookid]["slot"] = i
- allBooks[bookid]["actief"] = 0
- end
- end
- end
- bookid = bookid + 1
- allBooks[bookid] = {"name","slot","actief"}
- allBooks[bookid]["name"] = "None"
- allBooks[bookid]["slot"] = 1
- allBooks[bookid]["actief"] = 0
- while (true) do
- monitor.clear()
- monitor.setCursorPos(1,1)
- for i = 1, #allBooks do
- monitor.setCursorPos(1,i)
- if allBooks[i]["actief"] == 0 then
- monitor.setTextColor(colors.white)
- monitor.write(allBooks[i]["name"])
- else
- monitor.setTextColor(colors.red)
- monitor.write(allBooks[i]["name"])
- monitor.setTextColor(colors.white)
- end
- end
- event, side, xPos, yPos = os.pullEvent("monitor_touch")
- if allBooks[yPos] ~= nil then
- for i = 1, #allBooks do allBooks[i]["actief"] = 0 end
- allBooks[yPos]["actief"] = 1
- end
- portalLoc.pushItem("north",1,64)
- for i = 1, 16 do chestLoc.pullItem("west",i,64) end
- sleep(0.1)
- for i = 1, #allBooks do
- if allBooks[i]["actief"] == 1 then
- if allBooks[i]["name"] ~= "None" then
- chestLoc.pushItem("west",allBooks[i]["slot"],1)
- sleep(0.1)
- portalLoc.pullItem("north",1,64,1)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement