Jump to content

Got some errors in code

turtle api lua

2 replies to this topic

#1 besrezen

  • New Members
  • 1 posts

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
print("Please reload me with more items! (Press enter when done.)")
while k > 0 do
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
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.

#2 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

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 )

Will place a block from the 16th slot (lower right).


  • Members
  • 210 posts
  • LocationSomewhere in this dimension... I think.

Posted 07 February 2017 - 12:04 AM

turtle.place() uses currently selected slot. Similarly turtle.placeUp() turtle.placeDown()

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users