Griffork

Train Tunnel v1

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