Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local finished = false
- local wall = 0
- function line()
- turtle.select(2)
- if not turtle.detectDown() then
- turtle.placeDown()
- print("block placed")
- end
- if not turtle.detect() then
- turtle.forward()
- print("moving forward")
- else
- turtle.select(3)
- if turtle.compare() then
- finished = true
- print("i am finished")
- else
- print("i have reached a wall")
- if wall == 0 then
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- while not turtle.detect() do
- turtle.forward()
- end
- print("i have reached the second wall")
- wall = 1
- turtle.turnRight()
- turtle.turnRight()
- elseif wall == 1 then
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- while not turtle.detect() do
- turtle.forward()
- end
- print("i have reached the third wall")
- wall = 0
- turtle.turnLeft()
- turtle.turnLeft()
- end
- end
- end
- end
- while finished == false do
- if turtle.getItemCount(2) == 1 then
- print("i have run out of blocks")
- os.pullevent("turtle_inventory")
- print("my inventory has changed, sure hope it was blocks")
- end
- if turtle.getFuelLevel() < 1 then
- turtle.select(1)
- turtle.refuel(1)
- print("i have refueled")
- end
- line()
- print("restarting while loop")
- end
Advertisement
Add Comment
Please, Sign In to add comment