Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- This script digs a 1 x 3 high tunnel
- -- to the length you are prompted,
- -- places a torch on the side wall,
- -- and returns.
- -- Put torches in slot 16 (bottom right corner)
- --
- -- Place the turtle on the floor level of your tunnel
- --------------------------------------------------------
- function digIt()
- while turtle.detect() do
- turtle.dig()
- os.sleep(1.0)
- end
- turtle.forward()
- while turtle.detectDown() or turtle.detectUp() do
- turtle.digUp()
- turtle.digDown()
- end
- end
- function placeTorch()
- turtle.back()
- turtle.select(16)
- turtle.placeUp()
- turtle.forward()
- turtle.select(1)
- end
- -- this sets the initial variable values ----------------
- local run = 0
- local j = 0
- local k = 0
- term.write("Length of Branch? ") -- You are prompted to enter a tunnel length ----------------
- run = read()
- ----------------------------------------------------------------------------------------
- -- This is the main command to dig the tunnel ----------------
- turtle.up()
- for i = 1, run do
- k = i - 1
- j = k % 5 -- This determines how many squares to place a torch ie: 5 ----------------
- if j == 1 then
- placeTorch()
- end
- digIt() -- this digs the tunnel length you typed in ----------------
- end
- -- this places a torch at the end of the tunnel, drops to the floor,
- -- turns around, and returns to the start
- turtle.select(16)
- turtle.placeUp()
- turtle.turnRight()
- turtle.turnRight()
- turtle.down()
- for i = 1, run do -- this tells the turtle to head back the same number of squares it dug ----------------
- turtle.forward()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement