Posted 28 September 2012 - 08:06 PM
It's been years since my FORTRAN and COBAL days, but DW's CC tutorials videos have re-lit the flame.
The goal = get comfortable with LUA and develope an ultra simple strip mining program.
This code would start at bedrock, mine up, mine in and come back out. Writing the code out long hand worked great. Incorrectly incorporating DW's functions causes this code to simply not run. No errors, I just come back to the command prompt. Clearly, I've jacked up the way functions interact with the main part of the code. Once I get this relationship down, I'll finish it and move on to the rest of the strip mining code.
Where did I go wrong?
function vertical()
for i = 1, height do
while not turtle.up() do
turtle dig.up()
end
end
function deep()
for i = 1, depth do
while not turtle.forward() do
turtle.dig()
end
end
function aboutFace()
turtle.digDown()
turtle.down()
turtle.turnRight()
turtle.turnRight()
end
end
–Main Program
term.write("How many blocks up?")
height=read()
term.write("How many blocks deep?)
depth=read()
for i = 1, height do
vertical()
end
end
for i = 1, depth do
deep()
end
end
aboutFace()
end
Thanks for any pointers in advance!
The goal = get comfortable with LUA and develope an ultra simple strip mining program.
This code would start at bedrock, mine up, mine in and come back out. Writing the code out long hand worked great. Incorrectly incorporating DW's functions causes this code to simply not run. No errors, I just come back to the command prompt. Clearly, I've jacked up the way functions interact with the main part of the code. Once I get this relationship down, I'll finish it and move on to the rest of the strip mining code.
Where did I go wrong?
function vertical()
for i = 1, height do
while not turtle.up() do
turtle dig.up()
end
end
function deep()
for i = 1, depth do
while not turtle.forward() do
turtle.dig()
end
end
function aboutFace()
turtle.digDown()
turtle.down()
turtle.turnRight()
turtle.turnRight()
end
end
–Main Program
term.write("How many blocks up?")
height=read()
term.write("How many blocks deep?)
depth=read()
for i = 1, height do
vertical()
end
end
for i = 1, depth do
deep()
end
end
aboutFace()
end
Thanks for any pointers in advance!