Posted 14 December 2012 - 10:29 AM
I've been iterating a program that makes a mining turtle strip mine for coding practice. It's been modular, so I'm pretty sure the error is coming from the new code which goes from lines 10 to 24. The error is ") expected at line 10", so it's a syntax error for sure. Is there any way to replace this line of code with a loop that can check three or more conditions and lead to the same block of code?
term.clear()
term.setCursorPos(1,1)
print("Enter the depth of the desired tunnel.")
input = tonumber(io.read())
neededTorches = input/5
neededFuel = input * 2
torchIt = 0
caveInCheck = false
inputorg = input
if (neededTorches > turtle.getItemCount(15) OR (turtle.getFuelLevel() * 2) < neededFuel)) == false then
print("Insufficient supplies detected.")
print("Please load:")
if neededTorches > (turtle.getItemCount(15) then
print("["..neededTorches"] torches into slot 15.")
end
if turtle.getFuelLevel < neededFuel then
print("["..neededFuel"] heat units worth of combustable fuel into slot 1.")
end
if turtle.getItemCount(16) = 0 then
print("[1] or more chests of any type to slot 16.")
end
print("Once loaded, press ENTER to continue.")
io.read()
end
while input > 0 do
turtle.dig()
turtle.suck()
if turtle.detect() == true then
print("Cave in detected on depth level: "..input..". Compensating...")
caveInCheck = true
sleep(2)
else
caveInCheck = false
end
turtle.forward()
if caveInCheck == false then
turtle.digUp()
turtle.suckUp()
input = input - 1
torchIt = torchIt + 1
if torchIt == 6 then
turtle.back()
turtle.select(15)
turtle.placeUp()
turtle.forward()
torchIt = 0
end
end
end
print("Tunneling Complete. Returning to origin point.")
turtle.turnLeft()
turtle.turnLeft()
while inputorg ~= 0 do
turtle.forward()
inputorg = inputorg - 1
end
turtle.turnRight()
turtle.select(16)
turtle.place()
for x = 1, 15, 1 do
turtle.select(x)
turtle.drop()
end
turtle.turnRight()
print("Standing by for next command.")