Posted 03 February 2013 - 03:44 AM
im trying to make a program that clears a area thats 3 high and then i can choose how fare it should mine forward and how many rows it should mine.
this code is made so fare so it should mine a 10x10 area but it only takes 2 rows how should i make it to take 10x10???
any help would be appreciated :)/>
this code is made so fare so it should mine a 10x10 area but it only takes 2 rows how should i make it to take 10x10???
local dis = 10
local rows = 10
---------------------------------------
local x = 0
local y = 0
local turns = 0
function Clear() -- Clear Screen
term.clear()
term.setCursorPos(1,1)
end
function Return() --return
if x == dis then
turtle.turnRight()
turtle.turnRight()
while x > 0 do
turtle.forward()
x = x - 1
end -- loop
end -- end if
end -- end function
function digForward()
print("Digforward function")
while x < dis do -- dig the first row
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.digDown()
x = x + 1
end
Return()
end
function digBackward()
print("DigBackward function")
while x > 1 do -- dig the first row
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.digDown()
x = x - 1
end
end
--------------------------------------
Clear()
turtle.up()
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.digDown()
x = x + 1
print("ready to start")
digForward()
if turns < rows then
turtle.turnRight() -- turn right
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.digDown()
turtle.turnRight()
rows = turns + 1
end
digBackward()
if turns < rows then
turtle.turnLeft() -- turn left
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.digDown()
turtle.turnLeft()
rows = rows + 1
end
any help would be appreciated :)/>