Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local col = 1
- local loc = 1
- function fuel()
- while true do
- if turtle.getFuelLevel() < 50 then
- print("current fuel is " ..turtle.getFuelLevel().. " need 50+")
- print("Please insert fuel source in slot 1")
- for i=1, 16 do
- turtle.select(i)
- turtle.refuel()
- end
- break
- else
- break
- end
- end
- end
- function go()
- while not turtle.forward() do
- fuel()
- turtle.dig()
- turtle.attack()
- sleep(.5)
- end
- vDig()
- end
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function up()
- loc = loc + 1
- turtle.up()
- end
- function yCount()
- turtle.digUp()
- up()
- end
- function vDig()
- repeat yCount()
- until turtle.detectUp() == false
- if turtle.detectUp() == false then
- for i=1, 4 do
- yCount()
- end
- end
- for u=1, loc do
- turtle.down()
- end
- loc = 1
- end
- function forward()
- for i=1, x do
- if turtle.detectDown() == false then
- turtle.select(2)
- turtle.placeDown()
- else
- go()
- end
- end
- end
- term.write("How many blocks forward? ")
- x = tonumber(io.read())
- clear()
- while true do
- print("Do you want the turtle to turn")
- print("Right or Left? R/L ")
- local event, param1 = os.pullEvent ("char")
- if param1 == "l" then
- print(" You chose Left! ")
- direction = "Left"
- sleep(2)
- break
- elseif param1 == "r" then
- print("You chose Right! ")
- direction = "Right"
- sleep(2)
- break
- else
- print ("Not valid!")
- sleep(1.5)
- clear()
- end
- end
- clear()
- print("How many blocks to the " ..direction)
- print("do you want to go? ")
- y = tonumber(io.read())
- clear()
- print("Checking fuel...")
- sleep(2)
- fuel()
- sleep(2)
- if direction == "Left" then
- print("Starting! Left! ")
- else
- print("Starting! Right!")
- end
- for i=1,y do
- forward()
- if i < y then
- if direction == "Left" then
- turtle.turnLeft()
- go()
- turtle.turnLeft()
- direction = "Right"
- else
- turtle.turnRight()
- go()
- turtle.turnRight()
- direction = "Left"
- end
- end
- end
- clear()
Advertisement
Add Comment
Please, Sign In to add comment