Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---@diagnostic disable: lowercase-global
- SLOT_COUNT = 16
- -- Goes through each slot and checks which item slot matches the input (itemName)
- function getItemIndex(itemName)
- for slot = 1, SLOT_COUNT, 1 do
- local item = turtle.getItemDetail(slot)
- if (item ~= nil) then
- if(item["name"] == itemName) then
- return slot
- end
- end
- end
- end
- function waitforsale()
- local ignore, id = rednet.receive()
- local itemIndex = getItemIndex("minecraft:" .. tostring(id))
- if itemIndex ~= nil then
- turtle.select(itemIndex)
- turtle.drop()
- rednet.broadcast("Item Dropped")
- else
- rednet.broadcast("Item Not Found")
- end
- end
- while true do
- turtle.suckUp()
- waitforsale()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement