Posted 02 February 2013 - 10:29 AM
I'm trying to write a basic mining script for turtles. It's designed to dig a 1x1x50 tunnel horizontally and check the rows above, below, and to each side of it for each of four items (gravel, dirt, stone, and marble, although it could be any items). It will dig the item if it is not one of the specified four. It also contains a function to ensure that gravel doesn't prevent it from going the full 50 blocks horizontally.
Unfortunately, I'm running into an error. I have no clue what's causing it. I'm a relative novice with LUA, so I was hoping for some help. Here's the error:
"bios:338: [string "mine"]:53: 'end' expected (to close 'function' at line 7)
Unfortunately, I'm running into an error. I have no clue what's causing it. I'm a relative novice with LUA, so I was hoping for some help. Here's the error:
"bios:338: [string "mine"]:53: 'end' expected (to close 'function' at line 7)
function check()
if (turtle.compare(1)==false) and (turtle.compare(2)==false) and (turtle.compare(3)==false) and (turtle.compare(4)==false) then do
turtle.dig()
end
end
function checkDown()
if (turtle.compareDown(1)==false) and (turtle.compareDown(2)==false) and (turtle.compareDown(3)==false) and (turtle.compareDown(4)==false) then do
turtle.digDown()
end
end
function checkUp()
if (turtle.compareUp(1)==false) and (turtle.compareUp(2)==false) and (turtle.compareUp(3)==false) and (turtle.compareUp(4)==false) then do
turtle.digUp()
end
end
function gravel()
while (turtle.compare(1)==true) do
turtle.dig()
end
end
local i = 1
while i<=50 do
turtle.dig()
gravel()
turtle.forward()
checkUp()
checkDown()
turtle.turnLeft()
check()
turtle.turnRight()
turtle.turnRight()
check()
turtle.turnLeft()
i=i+1
end
while i==51 do
turtle.turnRight()
turtle.turnRight()
i=i+1
end
while (i>=52) and (i<=101) do
turtle.forward()
i=i+1
end
end
Edited by