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

Can i make a turtle suck an item out of a chest?

Started by fatmanguy88, 20 January 2013 - 06:49 AM
fatmanguy88 #1
Posted 20 January 2013 - 07:49 AM
I want to make a turtle suck saplings and bonemeal out of a chest and place it in his second and third slot? Is this possible? and if so how do i do it?
W00dyR #2
Posted 20 January 2013 - 07:53 AM
use the turtle functions


turtle.suck()

and


turtle.transferTo(slot, quantity)

if they are in the wrong slots
FF0084 #3
Posted 20 January 2013 - 07:54 AM
Turtle functions

Function turtle.suck() is the one you're looking for. If you want to place these items in nth slot, make sure it's selected first (turtle.select(…)) and that it's empty (turtle.getItemCount(…) == 0), otherwise it'll land in the next free slot.
fatmanguy88 #4
Posted 20 January 2013 - 08:05 AM
Turtle functions

Function turtle.suck() is the one you're looking for. If you want to place these items in nth slot, make sure it's selected first (turtle.select(…)) and that it's empty (turtle.getItemCount(…) == 0), otherwise it'll land in the next free slot.
Alright cool, can i make him suck out a specific item like lets say in the chest there is 4 items, in the first slot cobble stone, in the second saplings, in the third bonemeal, and in the forth wood, can i make the turtle suck out the second and third slots only?
W00dyR #5
Posted 20 January 2013 - 08:10 AM
Turtle functions

Function turtle.suck() is the one you're looking for. If you want to place these items in nth slot, make sure it's selected first (turtle.select(…)) and that it's empty (turtle.getItemCount(…) == 0), otherwise it'll land in the next free slot.
Alright cool, can i make him suck out a specific item like lets say in the chest there is 4 items, in the first slot cobble stone, in the second saplings, in the third bonemeal, and in the forth wood, can i make the turtle suck out the second and third slots only?

You can only make it suck out a certain number of items, not from a certain slot

However, you can do something like,


for i = 1, 3 do
   turtle.suck()
end
turtle.select(1)
turtle.drop()

this sucks out 3 times, so the first, second and third slot
then it selects the first slot (the first item it sucked out of the chest) and dumps it back
FF0084 #6
Posted 20 January 2013 - 08:11 AM
I'm afraid you have no control when sucking the items. The turtle receives the item from a non-empty slot with the lowest index ( i.e. if slot 1 is empty and slot 2 is filled, it picks the slot 2 ).
fatmanguy88 #7
Posted 20 January 2013 - 08:14 AM
Turtle functions

Function turtle.suck() is the one you're looking for. If you want to place these items in nth slot, make sure it's selected first (turtle.select(…)) and that it's empty (turtle.getItemCount(…) == 0), otherwise it'll land in the next free slot.
Alright cool, can i make him suck out a specific item like lets say in the chest there is 4 items, in the first slot cobble stone, in the second saplings, in the third bonemeal, and in the forth wood, can i make the turtle suck out the second and third slots only?

You can only make it suck out a certain number of items, not from a certain slot

However, you can do something like,


for i = 1, 3 do
   turtle.suck()
end
turtle.select(1)
turtle.drop()

this sucks out 3 times, so the first, second and third slot
then it selects the first slot (the first item it sucked out of the chest) and dumps it back
Alright cool, thank you very much this has been helpful.