1 posts
Posted 29 July 2012 - 05:44 PM
Hello, I am a total noob to ComputerCraft and I was wondering is there any way I can make my turtle drop certain blocks like cobblestone and dirt, could you also give me a tutorial on how to use the code?
Thank you very much.
35 posts
Location
Norway
Posted 30 July 2012 - 03:24 AM
turtle.select( number ) -- number = the inventory slot the item to drop is in.
turtle.drop() -- drops the item
26 posts
Posted 30 July 2012 - 04:11 PM
If you want to have the turtle drop a block that is the same as a block around it, you can use the turtle.compare() function:
turtle.select(1) --Selects the first slot in your turtle's inventory, let's pretend it's dirt--
if turtle.compare() then --If the block in front of the turtle is dirt, then this is true--
print("There is dirt in front of me!") --This will display on the screen--
else
print("Whatever is in front of me, it sure is not dirt")
end
Obviously, it's easy to use this function to drop dirt using basically the same code.