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

turtle.place() fails for all wood

Started by Neuromancer, 23 January 2014 - 08:47 PM
Neuromancer #1
Posted 23 January 2014 - 09:47 PM
I am running the same program, and when I have wood, planks, or bookshelves in my inventory slot one, it fails, all the items disappear on the first failure. When I have cobble, sponge, glass, wool, etc. It works just fine and all the items are placed, and slot one is decremented 1 item at a time. Is this a bug for items containing wood? I'm using Minecraft 1.6.4, & Computercraft 1.58.
  • turtle.refuel()
  • for count2 = 1, 4 do
  • for count = 1, 3 do
  • if turtle.place() then
  • print('placed')
  • else
  • print('failed')
  • end
  • turtle.back()
  • end
  • turtle.turnRight()
  • end
Lyqyd #2
Posted 24 January 2014 - 12:31 AM
You do realize that all of those items that "disappear" are burnable and will be consumed as fuel when the turtle.refuel() call is made?

This is not a bug. Moved to Ask a Pro.
surferpup #3
Posted 24 January 2014 - 12:56 AM
It makes it much easier for members if you put your code in code sections, like this:


turtle.refuel()
for count2 = 1, 4 do
  for count = 1, 3 do
    if turtle.place() then
	  print('placed')
    else
	  print('failed')
    end
    turtle.back()
  end
  turtle.turnRight()
end

The refuel() command without any arguments will consume all of the fuel in the current slot (which defaults to slot 1 if unassigned.) If you want the turtle to only consume one piece of fuel, you would type in refuel(1). The number you type in is the number of items it will attempt to take from the stack in the currently selected inventory slot. As Lyqyd mentioned, any fuel item in that slot will be consumed (and wood is a fuel item).

Please refer to the Turtle (API) found in the Wiki for a full description of all of the turtle commands.
Edited on 24 January 2014 - 12:03 AM
Jim #4
Posted 24 January 2014 - 07:53 AM
You can always do

for i = 2, 16 do
  turtle.select(i)
  turtle.refuel()
end

This will consume everything burnable in slots 2-16. However, I'm pretty sure that's going to consume 1 piece per item in each slot. Maybe not, but I think I had a similar problem once.
Edited on 24 January 2014 - 04:47 PM
surferpup #5
Posted 24 January 2014 - 01:32 PM
No, in your example, you left the parenthesis off of the turtle.refuel() command. It will actually error. However, with no argument, this will consume all of the fuel in each slot from 2-16.
Buho #6
Posted 24 January 2014 - 02:44 PM
See http://computercraft.info/wiki/Turtle.refuel

If a quantity is specified, it will refuel only up to that many items (if 32 is specified and 16 is present only 16 will be consumed), otherwise, it will consume all the items in the slot.
Jim #7
Posted 24 January 2014 - 05:48 PM
Yeah, I was mistaken with turtle.select().
Neuromancer #8
Posted 24 January 2014 - 08:46 PM
Thanks for the replies. That was driving me nuts, and here it was something so simple.