Advertisement
Steakbroetchen

GPS

Oct 25th, 2013
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. shell.run("clear")
  2. rednet.open("right")
  3. local x, y, z = gps.locate(5)
  4. if x == nil then
  5. print("Kein GPS-Signal")
  6. sleep(3)
  7. shell.run("clear")
  8. print("Programm-Abruch")
  9. sleep(3)
  10. error()
  11. end
  12. print("Aktuelle Position: ",x," ",y," ",z)
  13. print("Zielkoordinaten:")
  14. print("X: ")
  15. local xx = read()
  16. print("Y: ")
  17. local yy = read()
  18. print("Z: ")
  19. local zz = read()
  20. local xxx = tonumber(xx)
  21. local yyy = tonumber(yy)
  22. local zzz = tonumber(zz)
  23. shell.run("clear")
  24. print("Aktuelle Position: ",x," ",y," ",z)
  25. print("Zielkoordinaten: ",xxx," ",yyy," ",zzz)
  26. print("Navigation starten? <JA/NEIN>")
  27. if read() == "NEIN" then
  28. shell.run("clear")
  29. print("Programm-Abruch")
  30. sleep(3)
  31. error()
  32. end
  33. while 1 do
  34. local x, y, z = gps.locate(1)
  35. if z < 220 then
  36. rs.setBundledOutput("back", colors.purple)
  37. sleep(0.1)
  38. rs.setBundledOutput("back", colors.purple)
  39. sleep(0.1)
  40. rs.setBundledOutput("back", colors.blue)
  41. sleep(0.1)
  42. rs.setBundledOutput("back", colors.blue)
  43. sleep(0.1)
  44. end
  45. if x > xxx then
  46. redstone.setBundledOutput("back", colors.gray)
  47. sleep(0.1)
  48. redstone.setBundledOutput("back", colors.gray)
  49. sleep(0.1)
  50. rs.setBundledOutput("back", colors.pink)
  51. sleep(0.1)
  52. rs.setBundledOutput("back", colors.pink)
  53. sleep(0.1)
  54. end
  55. if x < xxx then
  56. redstone.setBundledOutput("back", colors.yellow)
  57. sleep(0.1)
  58. redstone.setBundledOutput("back", colors.yellow)
  59. sleep(0.1)
  60. rs.setBundledOutput("back", colors.lime)
  61. sleep(0.1)
  62. rs.setBundledOutput("back", colors.lime)
  63. sleep(0.1)
  64. end
  65. if y > yyy then
  66. redstone.setBundledOutput("back", colors.white)
  67. sleep(0.1)
  68. redstone.setBundledOutput("back", colors.white)
  69. sleep(0.1)
  70. rs.setBundledOutput("back", colors.orange)
  71. sleep(0.1)
  72. rs.setBundledOutput("back", colors.orange)
  73. sleep(0.1)
  74. end
  75. if y < yyy then
  76. redstone.setBundledOutput("back", colors.magenta)
  77. sleep(0.1)
  78. redstone.setBundledOutput("back", colors.magenta)
  79. sleep(0.1)
  80. rs.setBundledOutput("back", colors.lightBlue)
  81. sleep(0.1)
  82. rs.setBundledOutput("back", colors.lightBlue)
  83. sleep(0.1)
  84. end
  85. if z < zzz
  86. rs.setBundledOutput("back", colors.purple)
  87. sleep(0.1)
  88. rs.setBundledOutput("back", colors.purple)
  89. sleep(0.1)
  90. rs.setBundledOutput("back", colors.blue)
  91. sleep(0.1)
  92. rs.setBundledOutput("back", colors.blue)
  93. sleep(0.1)
  94. end
  95. end
  96. while 1 do
  97. local x, y, z = gps.locate(1)
  98. if z > zzz
  99. redstone.setBundledOutput("back", colors.cyan)
  100. sleep(0.1)
  101. redstone.setBundledOutput("back", colors.cyan)
  102. sleep(0.1)
  103. rs.setBundledOutput("back", colors.lightGray)
  104. sleep(0.1)
  105. rs.setBundledOutput("back", colors.lightGray)
  106. sleep(0.1)
  107. end
  108. if z == zzz
  109. shell.run("clear")
  110. error()
  111. end
  112. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement