Posted 31 December 2012 - 05:55 AM
I've created a code to plant saplings, bone meal and chop it down. But at the moment all it does is chop the first block and go straight to the end code, which is to turn around.
I'm sure its a simple mistake but i have no idea :/
I'm sure its a simple mistake but i have no idea :/
print ("Bonemeal in 1")
print ("Saplings in 2 ")
print (" How Many Times? ")
-- Variables --
local treeheight = 0
local amount = read()
-- Functions --
local function turnaround()
for q = 1, 2 do
turtle.turnLeft()
end
turtle.forward()
for e = 1, 2 do
turtle.turnLeft()
end
end
local function plant()
turtle.select(1)
turtle.place()
turtle.select(2)
turtle.place()
end
local function timber()
while turtle.detectUp() do
turtle.digUp()
turtle.up()
treeheight = treeheight + 1
end
end
-- Main Code --
for i = 1, amount do
plant()
sleep(1)
turtle.dig()
turtle.forward()
timber()
for w = 1, treeheight do
turtle.down()
end
turnaround()
end