Zachman61

Untitled

Sep 28th, 2014
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.62 KB | None | 0 0
  1. local arg = {...}
  2. local tunnelDistance = 1
  3. local traveled = 0
  4. if arg[1] then
  5.     tunnelDistance = tonumber(arg[1])
  6. else
  7.     while true do
  8.         term.write("How long should I tunnel for?")
  9.         tunnelDistance = tonumber(read())
  10.         if tunnelDistance then
  11.             break
  12.         end
  13.         print("Cannot Compute")
  14.     end
  15. end
  16. while true do
  17.     if not turtle.detect() then
  18.         turtle.forward()
  19.         traveled = traveled + 1
  20.     else
  21.         break
  22.     end
  23. end
  24. if tunnelDistance == 1 then
  25.     tunnelDistance = 2
  26. end
  27. shell.run("tunnel", tunnelDistance + 1)
  28. shell.run("turn", "right", "2")
  29. shell.run("go","forward",  tunnelDistance + traveled )
  30. shell.run("turn", "right", "2")
Advertisement
Add Comment
Please, Sign In to add comment