Advertisement
Guest User

nm

a guest
Dec 17th, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.53 KB | None | 0 0
  1. os.loadAPI("t")
  2.  
  3. local length = 25
  4. local myPos = 0
  5. local returnin = false
  6.  
  7. local args = {...}
  8. print (#args)
  9. if #args > 1 then length = args[1] end
  10.  
  11. function mineOne()
  12.     t.df()
  13.     t.f()
  14.     t.dd()
  15.     t.du()
  16.    
  17.     if returning then myPos = myPos -1
  18.     else myPos = myPos + 1
  19.     end
  20.  print(myPos)
  21. end
  22.  
  23. while (myPos < length) do
  24.     mineOne()
  25. end
  26. print("end of line")
  27. turtle.turnRight()
  28. t.df()
  29. t.f()
  30. t.du()
  31. t.dd()
  32. turtle.turnRight()
  33. returning = true
  34. print("turn complete")
  35. while (myPos > 0) do
  36.     mineOne()
  37. end
  38. print ("returned home")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement