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

Got some errors in code

Started by besrezen, 06 February 2017 - 05:09 AM
besrezen #1
Posted 06 February 2017 - 06:09 AM
Got an error in code.
Trying to use old scrip of pokemonmegaman user
It is used to build voxelized 3D model of any item you want

Turtle reads voxel file just fine, begins to build, but only checks one slot

if turtle.getItemCount(1) == 0 then
local k = 0
while turtle.detectDown() == false do
k = k + 1
turtle.down()
end
print("Please reload me with more items! (Press enter when done.)")
io.read()
while k > 0 do
turtle.up()
k = k - 1
If there is no items, turtle get down and asks for resources. The problem is, that i need turtle to use full inventory of blocks, and not only the 1st slot, of course i can change slot to check, but it will build only from slot 1.
Do i have to use
turtle.select(2)
turtle
.transferTo(1)
or turtle can place blocks from any slot? If it can build from any slot, then which command do i have to use?
Sorry for my bad english, it's not my native language.
KingofGamesYami #2
Posted 06 February 2017 - 11:13 PM
You can build from any slot. The turtle.place command uses the items in the currently selected slot. For example,


turtle.select( 16 )
turtle.place()

Will place a block from the 16th slot (lower right).
TYKUHN2 #3
Posted 07 February 2017 - 12:04 AM
turtle.place() uses currently selected slot. Similarly turtle.placeUp() turtle.placeDown()