Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rcid = 59 --Remote computer id
- c = peripheral.wrap("back")
- rednet.open("top")
- function split(inputstr, sep)
- if sep == nil then sep = "%s" end
- local t={} ; i=1
- for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
- t[i] = str
- i = i + 1
- end
- return t
- end
- function moveItem(slotNew)
- c.pullItem("up",1,1,1)
- c.pushItem("up",slotNew,1,1)
- end
- function getBooks()
- message = ""
- for i = 1, c.getInventorySize() do
- if c.getStackInSlot(i) == nil then return message end
- name = c.getStackInSlot(i).destination
- message = message..name.."/"
- end
- return message
- end
- while true do
- event, id, message = os.pullEvent("rednet_message")
- n = split(message,"/")
- if n[1] == "name" then
- c.pullItem("up",1,1,1)
- c.condenseItems()
- message = getBooks()
- rednet.send(rcid,message)
- elseif n[1] == "move" then
- moveItem(n[2])
- message = transferred
- --rednet.send(rcid,message)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment