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

Stripmining Program

Started by rpg4mc, 27 December 2012 - 12:59 PM
rpg4mc #1
Posted 27 December 2012 - 01:59 PM
hello,

today I made my first program, it's a program to stripmine :)/>


local times = 0
local j = 0
function Mine()
  while turtle.detect() == true do
    turtle.dig()
    sleep(0.50)
  end
  turtle.forward()
  sleep(0.50)
  while turtle.detectUp() == true do
    turtle.digUp()
    sleep(0.50)
  end
  turtle.digDown()
end
function Place(SlotNum)
  turtle.select(SlotNum)
  turtle.back()
  turtle.placeUp()
  turtle.forward()
end
term.write("How long? ")
times = read()
function Digger()
  for i=1, times do
    j = j+1
    Mine()
    if j == 7 then
	  Place(16)
	  j = 0
    end
  end
end
function MoveLeft()
  turtle.turnLeft()
  Mine() 
  Mine()
  Mine()
  turtle.turnLeft()
end
function MoveRight()
  turtle.turnRight()
  Mine()
  Mine()
  Mine()
  turtle.turnRight()
end
term.write("How many double shafts? ")
duration = read()
for i=1, duration do
  Digger()
  MoveLeft()
  Digger()
  MoveRight()
end

If you have any questions, remarks or improvements I could do, please tell them so this noob can learn :)/>
Jack #2
Posted 29 December 2012 - 02:18 AM
Screenshots? What does the mine look like?