Posted 23 July 2013 - 12:33 PM
I ask the user to input a number then I save that number as tunnel. The problem is that on line 40 the repeat loop is not recognizing tunnel as a number and the loop keeps continuing without stopping.
local function torch()
if x % 5 == 0 then
turtle.select(1)
turtle.turnRight()
turtle.turnRight()
turtle.place()
turtle.turnLeft()
turtle.turnLeft()
end
end
local function chest()
turtle.up()
for y = 1,tunnel + 1 do
turtle.back()
end
turtle.select(2)
for inv = 2, 16 do
turtle.dropDown(64)
end
end
print("how long is the tunnel")
tunnel=read()
x=0
repeat
if turtle.detect() == false then
turtle.forward()
turtle.digUp()
x=x+1
elseif turtle.detect()==true then
repeat
turtle.dig()
turtle.detect()
until turtle.detect()==false
turtle.forward()
turtle.digUp()
x=x+1
end
torch()
until x==tunnel – problem is here
print (x)
chest()
local function torch()
if x % 5 == 0 then
turtle.select(1)
turtle.turnRight()
turtle.turnRight()
turtle.place()
turtle.turnLeft()
turtle.turnLeft()
end
end
local function chest()
turtle.up()
for y = 1,tunnel + 1 do
turtle.back()
end
turtle.select(2)
for inv = 2, 16 do
turtle.dropDown(64)
end
end
print("how long is the tunnel")
tunnel=read()
x=0
repeat
if turtle.detect() == false then
turtle.forward()
turtle.digUp()
x=x+1
elseif turtle.detect()==true then
repeat
turtle.dig()
turtle.detect()
until turtle.detect()==false
turtle.forward()
turtle.digUp()
x=x+1
end
torch()
until x==tunnel – problem is here
print (x)
chest()