Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("right")
- senderId, message, distance = rednet.receive(3)
- if distance == nil then
- print("Could not locate")
- sleep(2)
- os.shutdown()
- end
- olddistance = distance
- turtle.forward()
- senderId, message, distance = rednet.receive(3)
- if olddistance > distance then
- while true do
- olddistance = distance
- turtle.forward()
- distance = rednet.receive(3)
- if distance > olddistance then
- break
- end
- end
- elseif distance > olddistance then
- distance = olddistance
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- senderId, message, distance = rednet.receive(3)
- if distance > olddistance then
- print("ERROR!")
- sleep(2)
- os.shutdown()
- end
- while true do
- olddistance = distance
- turtle.forward()
- senderId, message, distance = rednet.receive(3)
- if distance > olddistance then
- break
- end
- end
- end
- print("Aligned. Hopefully.....")
Advertisement
Add Comment
Please, Sign In to add comment