This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
2bitmarksman's profile picture

Selective Inventory extractor program

Started by 2bitmarksman, 13 May 2013 - 08:42 PM
2bitmarksman #1
Posted 13 May 2013 - 10:42 PM
I am completely unfamiliar with Lua programming and have run into a problem that I am sure Turtles can solve; I'd like to have a turtle extract ALL but a single item type (Glass Phials) from an inventory and place them in another adjacent inventory to the turtle (or the turtle can house them and I can extract the items from the turtle). Magic Tallow golems get empty phials and put filled phials into the same chest and instead of manually having to put the phials into the storage system I'd like a turtle to automate the extraction portion for me. Keeping the chest filled with phials is easy but theres no other way I can think of to be able to have an inventory extract all but a single item type from an inventory except for turtles :S.
Lyqyd #2
Posted 14 May 2013 - 02:47 PM
Split into new topic.
BlankTitle #3
Posted 14 May 2013 - 07:01 PM
You could try placing the glass phials at the end of a chest, so when the turtle extracts its inventory is filled before it can extract the phials.
KaoS #4
Posted 15 May 2013 - 03:04 AM
is there an item ID difference in empty and full phials? if so then we can do this, if not you're pretty screwed
panicmore #5
Posted 15 May 2013 - 06:26 AM
is there an item ID difference in empty and full phials? if so then we can do this, if not you're pretty screwed
yes there is
KaoS #6
Posted 15 May 2013 - 07:59 AM
okay, take an empty phial and place it in the first inventory slot of the turtle, then run this code


turtle.select(2)
while turtle.suckDown() do
  turtle["drop"..(turtle.compareTo(1) and "" or "Up")]()
end

he will suck all items out of the chest beneath him and spit the phials out into an inventory in front of him, he will put all other items into the inventory above him