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

Dig Program Help Please

Started by alexisbadyo, 25 May 2016 - 10:29 PM
alexisbadyo #1
Posted 26 May 2016 - 12:29 AM
Alright so i know nothing about programing so I'm here to ask for some help. Pretty much all i want to do is have a mining turtle break a block in a cobblestone generator pick up that block and do it 64 times then turn to a chest and place all 64 cobblestone in the chest then do it all again can anyone help me please
KingofGamesYami #2
Posted 26 May 2016 - 02:12 AM

while true do --#do everything inside this loop forever
  for i = 1, 64 do --#do everything inside this loop 64 times
    turtle.dig() --#break the block in front of the turtle
  end --#end of "do everything inside this loop 64 times"
  turtle.turnLeft() --#turn the turtle left
  turtle.drop( 64 ) --#drop 64 of whatever is in the currently selected slot (default: 1)
  turtle.turnRight() --#turn the turtle right
end --#end of "do everything inside this loop forever"

http://computercraft.info/wiki/Loops#The_While_loop
http://computercraft.info/wiki/Loops#The_For_loop
http://computercraft.info/wiki/Turtle.dig
http://computercraft.info/wiki/Turtle.turnLeft
http://computercraft.info/wiki/Turtle.turnRight
http://computercraft.info/wiki/Turtle.drop