daily pastebin goal
41%
SHARE
TWEET

ComputerCraft AutoPilot by likilike1234

a guest Jan 29th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[DIRECTIONS[ +X EAST, -X WEST, +Z SOUTH, -Z NORTH]]
  2.  
  3. --SOURCE COORDINATES and DIRECTION COORDINATES
  4. SX = 0
  5. SZ = 0
  6.  
  7. DX = 0
  8. DZ = 0
  9. --SOURCE COORDINATES and DIRECTION COORDINATES
  10.  
  11. --MEMORY
  12. MX = 0
  13. MZ = 0
  14. --MEMORY
  15.  
  16. --DIRECTION NUMBER OF BLOCKS
  17. X = 0
  18. Z = 0
  19. --DIRECTION NUMBER OF BLOCKS
  20.  
  21. --DIRECTION
  22. EAST = 0
  23. WEST = 0
  24. SOUTH = 0
  25. NORTH = 0
  26. --DIRECTION
  27.  
  28. --QUESTIONS
  29. print("Zadej ODKUD X: ")
  30. SX = tonumber(read())
  31.  
  32. print("Zadej ODKUD Z: ")
  33. SZ = tonumber(read())
  34.  
  35. print("Zadej KAM X: ")
  36. DX = tonumber(read())
  37. MX = DX
  38.  
  39. print("Zadej KAM Z: ")
  40. DZ = tonumber(read())
  41. MZ = DZ
  42. --QUESTIONS
  43.  
  44. --PLUS
  45. if SX > 0 then
  46. if DX > 0 then
  47. X = SX - DX
  48. X = math.abs(X)
  49. EAST = 1
  50. end
  51. end
  52.  
  53. if SZ > 0 then
  54. if DZ > 0 then
  55. Z = SZ - DZ
  56. Z = math.abs(Z)
  57. SOUTH = 1
  58. end
  59. end
  60. --PLUS
  61.  
  62. --MINUS
  63. if SX < 0 then
  64. if DX < 0 then
  65. X = math.abs(SX) - math.abs(DX)
  66. X = math.abs(X)
  67. WEST = 1
  68. end
  69. end
  70.  
  71. if SZ < 0 then
  72. if DZ < 0 then
  73. Z = math.abs(SZ) - math.abs(DZ)
  74. Z = math.abs(Z)
  75. NORTH = 1
  76. end
  77. end
  78. --MINUS
  79.  
  80. --PLUS/MINUS
  81. if SX > 0 then
  82. if DX < 0 then
  83. X = math.abs(SX) + math.abs(DX)
  84. X = math.abs(X)
  85. WEST = 1
  86. end
  87. end
  88.  
  89. if SZ > 0 then
  90. if DZ < 0 then
  91. Z = math.abs(SZ) + math.abs(DZ)
  92. Z = math.abs(Z)
  93. NORTH = 1
  94. end
  95. end
  96. --PLUS/MINUS
  97.  
  98. --MINUS/PLUS
  99. if SX < 0 then
  100. if DX > 0 then
  101. X = math.abs(SX) + math.abs(DX)
  102. X = math.abs(X)
  103. EAST = 1
  104. end
  105. end
  106.  
  107. if SZ < 0 then
  108. if DZ > 0 then
  109. Z = math.abs(SZ) + math.abs(DZ)
  110. Z = math.abs(Z)
  111. SOUTH = 1
  112. end
  113. end
  114. --MINUS/PLUS
  115.  
  116.  
  117. --DEBUG PRINT
  118. print("X:")
  119. print(X)
  120.  
  121. print(" ")
  122.  
  123. print("Z:")
  124. print(Z)
  125.  
  126. print(" ")
  127.  
  128. print("Directions:")
  129.  
  130. print(" ")
  131.  
  132. print("EAST:")
  133. print(EAST)
  134.  
  135. print(" ")
  136.  
  137. print("WEST:")
  138. print(WEST)
  139.  
  140. print(" ")
  141.  
  142. print("SOUTH:")
  143. print(SOUTH)
  144.  
  145. print(" ")
  146.  
  147. print("NORTH:")
  148. print(NORTH)
  149. --DEBUG PRINT
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top