Http://pastebin.com/CMFGZLDR
Please Help!
for i = 1, 1 do
--Codez
end
Is unnecessary, you can just remove that for loop since it's only looping once.Well, your first problem is your using the variable "i" for multiple for loops. Make sure to use a different variable for each loop.
while not turtle.forward() do --Here is where I've tried to add the gravel remove part.
turtle.dig()
end
turtle.dig()
turtle.digUp()
turtle.forward()
turtle.digUp()
local function forward()
while not turtle.forward() do
turtle.dig()
turtle.attack()
end
end
local distance = tonumber(read())
for i=1,distance do
forward()
turtle.placeDown()
end
turtle.turnLeft()
forward()
turtle.turnLeft()
for i=1,distance do
forward()
end
local function forward()
while not turtle.forward() do turtle.dig() end
end
local dist
repeat
dist = tonumber( read() )
until dist
for i = 1, dist do
repeat until not turtle.digUp()
if not turtle.detectDown() then
turtle.placeDown()
end
forward()
end
print( 'returning' )
turtle.select( 16 ) --#if there are torches in slot 16
for i = 1, dist do
if i % 10 == 0 then
turtle.place()
end
turtle.back()
end
I'm hoping this does what you need. I thought your code looked a bit long for this.Well, your first problem is your using the variable "i" for multiple for loops. Make sure to use a different variable for each loop.
While it's a bad idea to use the same variable for nested loops (because it makes for a confusing mess to read), because the counter variable for a given "for" loop is automatically localised to that loop, it's technically valid code.