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

how to dump whole turtle inventory?

Started by TheFireMines1, 03 August 2013 - 11:32 PM
TheFireMines1 #1
Posted 04 August 2013 - 01:32 AM
Title: how to dump whole turtle inventory?

So I've been wondering how to dump the whole turtle inventory with only a couple of lines because i don't want to go thru the time of typing turtle.select(1) turtle.dump() turtle.select(2) etc.etc. and if you can how to skip some slots as in to not dump a specific slot.
Lyqyd #2
Posted 04 August 2013 - 02:14 AM
Split into new topic.

This would iterate through every slot in the turtle and drop all of the contents:


for i = 1, 16 do
  turtle.select(i)
  turtle.drop()
end
immibis #3
Posted 04 August 2013 - 04:32 AM
To clarify, Lyqyd's code is the same as this, but using a loop to make the code shorter and less repetitive:

turtle.select(1)
turtle.drop()
turtle.select(2)
turtle.drop()
turtle.select(3)
turtle.drop()
turtle.select(4)
turtle.drop()
turtle.select(5)
turtle.drop()
turtle.select(6)
turtle.drop()
turtle.select(7)
turtle.drop()
turtle.select(8)
turtle.drop()
turtle.select(9)
turtle.drop()
turtle.select(10)
turtle.drop()
turtle.select(11)
turtle.drop()
turtle.select(12)
turtle.drop()
turtle.select(13)
turtle.drop()
turtle.select(14)
turtle.drop()
turtle.select(15)
turtle.drop()
turtle.select(16)
turtle.drop()

[removed incorrect information about turtle.drop]
Lyqyd #4
Posted 04 August 2013 - 04:59 AM
That is incorrect; turtle.drop() with no arguments will drop all items in the selected slot.