feedmecookies

Floppy disk gps turtle

Jul 18th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. --define--
  2.  
  3.  
  4. --edit the file to info.lua if using CC tweaked--
  5. file = fs.open("/disk/info","r")
  6. x = 0
  7. y = 0
  8. z = 0
  9. tz = 0
  10. ty = 0
  11. tx = 0
  12. height = 3
  13. rotation = 3
  14. ----------
  15.  
  16. --functions--
  17. function rotate(w)
  18. while rotation ~= w do
  19. rotation = rotation + 1
  20. turtle.turnRight()
  21. if rotation == 5 then
  22. rotation = 1
  23. end
  24. end
  25. end
  26.  
  27. function GoX(cx,gx)
  28.  
  29. if cx > gx then
  30. rotate(4)
  31. for i = cx, gx + 1, -1 do
  32. turtle.forward()
  33. print("gox>")
  34. end
  35. elseif cx < gx then
  36. rotate(2)
  37. for i = cx, gx - 1 do
  38. turtle.forward()
  39. print("gox<")
  40. end
  41.  
  42. end
  43.  
  44. end
  45.  
  46. function GoY(cy,gy)
  47.  
  48. if cy > gy then
  49. for i = cy, gy + 1, -1 do
  50. turtle.digDown()
  51. turtle.down()
  52. end
  53. elseif cy < gy then
  54. for i = cy, gy - 1 do
  55. turtle.digUp()
  56. turtle.up()
  57. end
  58. end
  59. end
  60.  
  61. function GoZ(cz,gz)
  62. print("atleast it called")
  63. if cz > gz then
  64. rotate(1)
  65. for i = cz, gz+1, -1 do
  66. turtle.forward()
  67. print(i)
  68. end
  69. elseif cz < gz then
  70. rotate(3)
  71. for i = cz, gz - 1 do
  72. turtle.forward()
  73. print(i)
  74. end
  75. end
  76. end
  77.  
  78. function Drop()
  79. end
  80. -------------
  81.  
  82. --main--
  83. GoY(y,height)
  84. GoY(height,y)
  85. --------
Add Comment
Please, Sign In to add comment