Posted 04 July 2017 - 05:07 PM
I am aware it is messy and overly complex but I am incredibly new to programming and I'd appreciate any helpful solutions
– mining function
function mine()
for i = 1,200 do
– Dig a 3x3
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.turnLeft()
turtle.dig()
turtle.up()
turtle.dig()
turtle.digUp()
turtle.up()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
turtle.dig()
turtle.down()
turtle.dig()
turtle.down()
turtle.dig()
turtle.turnLeft()
– Refuel Function
if turtle.getFuelLevel <= 5
then
– Put fuel in this slot, slot 16
– Uses one coal per time
turtle.select(16)
turtle.refuel(1)
turtle.select(1)
end
if (turtle.getItemCount(16) < 15) then
turtle.digUp()
turtle.up()
turtle.digUp()
turtle.down()
turtle.select(15)
turtle.placeUp()
turtle.select(16)
turtle.suckUp(30)
turtle.select(15)
turtle.digUp()
end
if (turtle.getItemCount(12) > 0) or (turtle.getItemCount(13) > 0) then
turtle.digUp()
turtle.up()
turtle.digUp()
turtle.down()
turtle.select(14)
turtle.placeUp()
turtle.select(1)
turtle.dropUp(64)
turtle.select(2)
turtle.dropUp(64)
turtle.select(3)
turtle.dropUp(64)
turtle.select(4)
turtle.dropUp(64)
turtle.select(5)
turtle.dropUp(64)
turtle.select(6)
turtle.dropUp(64)
turtle.select(7)
turtle.dropUp(64)
turtle.select(8)
turtle.dropUp(64)
turtle.select(9)
turtle.dropUp(64)
turtle.select(10)
turtle.dropUp(64)
turtle.select(11)
turtle.dropUp(64)
turtle.select(12)
turtle.dropUp(64)
turtle.select(13)
turtle.dropUp(64)
turtle.select(14)
turtle.digUp()
turtle.select(1)
end
function stopDig()
print("Program ended by user")
for c = 1,distanceTraveled do turtle.back() end
distanceTraveled = 0
end
end
end
– mining function
function mine()
for i = 1,200 do
– Dig a 3x3
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.turnLeft()
turtle.dig()
turtle.up()
turtle.dig()
turtle.digUp()
turtle.up()
turtle.dig()
turtle.turnRight()
turtle.turnRight()
turtle.dig()
turtle.down()
turtle.dig()
turtle.down()
turtle.dig()
turtle.turnLeft()
– Refuel Function
if turtle.getFuelLevel <= 5
then
– Put fuel in this slot, slot 16
– Uses one coal per time
turtle.select(16)
turtle.refuel(1)
turtle.select(1)
end
if (turtle.getItemCount(16) < 15) then
turtle.digUp()
turtle.up()
turtle.digUp()
turtle.down()
turtle.select(15)
turtle.placeUp()
turtle.select(16)
turtle.suckUp(30)
turtle.select(15)
turtle.digUp()
end
if (turtle.getItemCount(12) > 0) or (turtle.getItemCount(13) > 0) then
turtle.digUp()
turtle.up()
turtle.digUp()
turtle.down()
turtle.select(14)
turtle.placeUp()
turtle.select(1)
turtle.dropUp(64)
turtle.select(2)
turtle.dropUp(64)
turtle.select(3)
turtle.dropUp(64)
turtle.select(4)
turtle.dropUp(64)
turtle.select(5)
turtle.dropUp(64)
turtle.select(6)
turtle.dropUp(64)
turtle.select(7)
turtle.dropUp(64)
turtle.select(8)
turtle.dropUp(64)
turtle.select(9)
turtle.dropUp(64)
turtle.select(10)
turtle.dropUp(64)
turtle.select(11)
turtle.dropUp(64)
turtle.select(12)
turtle.dropUp(64)
turtle.select(13)
turtle.dropUp(64)
turtle.select(14)
turtle.digUp()
turtle.select(1)
end
function stopDig()
print("Program ended by user")
for c = 1,distanceTraveled do turtle.back() end
distanceTraveled = 0
end
end
end