Posted 02 August 2012 - 04:59 AM
I'm trying to write my first program. the idea behind the program is that it will (eventually) tell the mining turtle to quarry until it's full then offload its inventory into a chest and continue until it hits bedrock. Currently it only (should) tell the turtle to mine out a 10x10 block.
My code currently:
It's probably just a syntax error but for the life of me I can't find it if it is.
Edit: I'm currently running on 1.3 (through the tekkit modpack)
P.S. yes I know excavate does something similar but it's more about learning the language than actual usefulness as code at this point.
My code currently:
Spoiler
function digfloor()
local i=0
local j=1
local forward=true
while j>11 do
j=j+1
while i>10 do
i=i+1
turtle.forward()
turtle.dig()
end
If forward==true then
turtle.turnLeft()
turtle.dig()
turtle.forward()
turtle.turnLeft()
forward=false
else
turtle.turnRight()
turtle.dig()
turtle.forward()
turtle.turnRight()
forward= true
end
end
end
local i=0
local y=rednet.receive() --gives the ability to start the process wirelessly
If y=="quarry" then
while i<4 do
i=i+1
digfloor()
end
end
It's probably just a syntax error but for the life of me I can't find it if it is.
Edit: I'm currently running on 1.3 (through the tekkit modpack)
P.S. yes I know excavate does something similar but it's more about learning the language than actual usefulness as code at this point.