Griffork

Train Tunnel v2

Aug 28th, 2012
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Check arguments for correct formatting
  2. local args = { ... }
  3. if #args ~= 1 then      --Check if it's not exactly 3 arguments.
  4.     shell.run("clear")
  5.     print("Invalid number of arguments")
  6.     print("turtletower [height]")
  7.     do return end
  8. end
  9. for i = 1, 1 do            --Step through each argument and make sure it is a number greater than 1.
  10.     if tonumber(args[i]) < 2 then
  11.         shell.run("clear")
  12.         print("Invalid arguments")
  13.         print("All measurements must be numbers greater than 1")
  14.         do return end
  15.     end
  16. end
  17. --------------------------------------------------
  18.  
  19. --commandline arguments [height]
  20. length = tonumber(args[1])  --length of tunnel
  21. slotnum = 1
  22. function checkSlots()
  23.     if turtle.getItemCount(slotnum) < 1 then
  24.         slotnum = slotnum + 1
  25.         turtle.select(slotnum)
  26.     end
  27.     return
  28. end
  29.  
  30. for i = 1, length do
  31.  
  32.     -- Add Some Flooring
  33.  
  34.     turtle.placeDown()
  35.  
  36.     turtle.turnLeft()
  37.     turtle.dig()
  38.     turtle.forward()
  39.  
  40.     -- Dig Most of the Tunnel
  41.     turtle.placeDown()
  42.     turtle.digUp()
  43.     turtle.up()
  44.     turtle.digUp()
  45.     turtle.up()
  46.     turtle.turnRight()
  47.     turtle.turnRight()
  48.     turtle.dig()
  49.     turtle.forward()
  50.     turtle.digDown()
  51.     turtle.down()
  52.     turtle.dig()
  53.     turtle.forward()
  54.     turtle.digUp()
  55.     turtle.digDown()
  56.     turtle.down()
  57.  
  58.     turtle.placeDown()
  59.     turtle.back()
  60.     turtle.turnLeft()
  61.     turtle.dig()
  62.     turtle.forward()
  63.  
  64. end
Advertisement
Add Comment
Please, Sign In to add comment