Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getItem()
- turtle.select(1)
- turtle.suck(1)
- local count = turtle.getItemCount(1)
- if count > 0 then
- local item = turtle.getItemDetail()
- turtle.drop(1)
- return item
- else
- return ""
- end
- end
- function main()
- local modem = peripheral.find("modem", rednet.open)
- local item = getItem()
- while true do
- local id, message = rednet.receive("storage_check")
- if message == "items" then
- rednet.send(id, item["name"], "storage_response")
- elseif string.match(message, "Item: ") then
- local temp = string.sub(message, 7, #message)
- rednet.send(id, temp == item["name"], "storage_response")
- end
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement