This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Marv-inside's profile picture

3X3 Tunnel Digger (Down)

Started by Marv-inside, 27 February 2012 - 09:31 PM
Marv-inside #1
Posted 27 February 2012 - 10:31 PM
This is my code for an 3+3 Tunnel digger!
(more later, currently its "Beta"

you have to rename the file, just delete the .txt (You aren't permitted to upload this kind of file)[attachment=51:tunnel.txt]



print("Insert 16 Cobble in slot 1!")
print("Press Enter if ready")
slot1 = turtle.getItemCount(1)
if slot1 > 15 then
io.read()
turtle.forward()
turtle.forward()
turtle.digDown()    --OOTOO
turtle.select(1)    --O   O
turtle.placeDown()  --O   O
	 --O   O
	 --OOOOO
turtle.turnRight()
turtle.forward()
turtle.digDown()    --OOXTO
turtle.placeDown() --O   O
	 --O   O
	 --O   O
	 --OOOOO
turtle.forward()
turtle.digDown()    --OOXXT
turtle.placeDown() --O   O
	 --O   O
	 --O   O
x1 = 0    --OOOOO
while x1 < 4 do
turtle.turnRight()
turtle.forward()
turtle.digDown()
turtle.placeDown()
x2 = 1
while x2 < 4 do
turtle.forward()
turtle.digDown()    --OOXXX
turtle.placeDown()  --O   T
x2 = (x2+1)   --O   O
print(x2)    --O   O
end	 --OOOOO
x1 = (x1+1)
print(x1)
end
turtle.back()
turtle.turnRight()
turtle.forward()
print("Is this Position ok?")
i = io.read()
if i == yes or y or 1 or ja or yay then
while true do -- digging down
  turtle.digDown()
  turtle.forward()
  turtle.digDown()
  turtle.forward()
  turtle.digDown()
 
  turtle.turnRight()
  turtle.forward()
  turtle.turnRight()

  turtle.digDown()
  turtle.forward()
  turtle.digDown()
  turtle.forward()
  turtle.digDown()

  turtle.turnLeft()
  turtle.forward()
  turtle.turnLeft()

  turtle.digDown()
  turtle.forward()
  turtle.digDown()
  turtle.forward()
  turtle.digDown()

  turtle.turnRight()
  turtle.turnRight()
  turtle.down()
end
end
end
ThePH #2
Posted 27 February 2012 - 10:53 PM
you should use more loops and functions.
Marv-inside #3
Posted 28 February 2012 - 12:47 AM
@ThePH yes, this is one of my first programm in lua, but currently i'm working an an woodcutter(http://www.computercraft.info/forums2/index.php?/topic/320-lumberjack/)
Jaan #4
Posted 28 February 2012 - 07:41 AM
Noobs! You just should use excavate on the turtle and insert the radius, it does the same when you write in the turtle: excavate 3
Marv-inside #5
Posted 28 February 2012 - 03:47 PM
@Jaan thx, was my first programm…

BUT this programm will show you the position and wait for you, untill it'll start! (not a big feature, but…)
Chub1337 #6
Posted 28 February 2012 - 03:51 PM
@Jaan thx, was my first programm…

BUT this programm will show you the position and wait for you, untill it'll start! (not a big feature, but…)

Haha, don't listen to Jaan, ofcourse it could use some tweeking here and there, but for a first program, I'm impressed! Good job! :D/>/>

-Chub1337
Marv-inside #7
Posted 28 February 2012 - 05:33 PM
@Chub1337 thx, i'm gona to check if there is only 1 slot left, and then go up to drop all items.