Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --put a turtle facing an ME interface
- --after running the program turtle will pull items into slot one
- --you need to pick up the thaumometer after the item changes for it to work, scan the item, then put the thaumometer back down (inside the turtle)
- --if you place thaumometer inside the turtle, it will automatically move to the next item
- --press P to pause, any other key will skip all item matching current ID (fuzzy skip for different durability armor, etc)
- --released into public domain pastebin.com/4xtrcVHp
- useTimerMethod = false --in case you want to scan on a timer instead of inventory change
- useInventoryMethod = true
- --change these directions to match your setup
- interface = peripheral.wrap("front")
- interface_export_dir = "south"
- avail = interface.getAvailableItems()
- turtle.select(1)
- turtle.drop()
- skip_id = ""
- timerID = 0
- count = 0
- print("Total items = " .. table.getn(avail))
- for k,v in pairs(avail) do
- count = count + 1
- if v.fingerprint.id ~= skip_id and v.size > 0 then
- print(count .. ": " .. v.fingerprint.id)
- interface.exportItem(v.fingerprint, interface_export_dir, 1)
- sleep(0.5)
- if useTimerMethod then
- timerID = os.startTimer(4)
- end
- while true do
- event, key = os.pullEvent()
- if event == "key" then
- if key == 25 then -- P
- print("Paused, ENTER to resume")
- io.read()
- print("Unpaused")
- else
- skip_id = v.fingerprint.id
- os.cancelTimer(timerID)
- break
- end
- end
- if event == "timer" then
- break
- end
- if useInventoryMethod and event == "turtle_inventory" then
- found_item = false
- for slot = 2, 16 do
- if turtle.getItemCount(slot) > 0 then
- found_item = true
- end
- end
- if found_item then
- os.cancelTimer(timerID)
- break
- end
- end
- end
- turtle.drop()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment