DailyCakeSlice

ComputerCraft Sort

Dec 27th, 2012
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.98 KB | None | 0 0
  1. print ("||||||||||||||||||||||||")
  2. print ("Checking Fuel...")
  3. beforeFuel = turtle.getFuelLevel()
  4. if beforeFuel<50 then
  5. print ("Fuel is very low! Console will refuel using 3 coal in the top left slot.")
  6. turtle.select(1)
  7. if turtle.refuel(3) then
  8. print ("Current fuel level: " .. turtle.getFuelLevel())
  9. print ("Please restart the program to contine sorting.")
  10. else
  11. print ("No coal to refuel with./n Please put 3 coal in the top left slot of the turtle and restart the program.")
  12. end
  13. else
  14. print ("Plenty of fuel.")
  15. print ("Sorting started...")
  16. turtle.forward()
  17.  
  18.  
  19.  
  20. turtle.select(13)
  21. if turtle.compare() then
  22. turtle.select(9)
  23. turtle.up()
  24. turtle.drop()
  25. else
  26. turtle.select(14)
  27. if turtle.compare() then
  28. turtle.select(10)
  29. turtle.up()
  30. turtle.drop()
  31. else
  32. turtle.select(15)
  33. if turtle.compare() then
  34. turtle.select(11)
  35. turtle.up()
  36. turtle.drop()
  37. else
  38. turtle.select(16)
  39. if turtle.compare() then
  40. turtle.elect(12)
  41. turtle.up()
  42. turtle.drop()
  43. else
  44. print ("There is an error. The block identifyer for the FIRST chest is not included in the system. Console will ignore this batch and continue sorting.")
  45. turtle.up()
  46. end
  47. end
  48. end
  49. end
  50. turtle.up()
  51. turtle.up()
  52.  
  53.  
  54.  
  55. turtle.select(13)
  56. if turtle.compare() then
  57. turtle.select(9)
  58. turtle.up()
  59. turtle.drop()
  60. else
  61. turtle.select(14)
  62. if turtle.compare() then
  63. turtle.select(10)
  64. turtle.up()
  65. turtle.drop()
  66. else
  67. turtle.select(15)
  68. if turtle.compare() then
  69. turtle.select(11)
  70. turtle.up()
  71. turtle.drop()
  72. else
  73. turtle.select(16)
  74. if turtle.compare() then
  75. turtle.elect(12)
  76. turtle.up()
  77. turtle.drop()
  78. else
  79. print ("There is an error. The block identifyer for the SECOND chest is not included in the system. Console will ignore this batch and continue sorting.")
  80. turtle.up()
  81. end
  82. end
  83. end
  84. end
  85. turtle.up()
  86. turtle.up()
  87.  
  88.  
  89.  
  90. turtle.select(13)
  91. if turtle.compare() then
  92. turtle.select(9)
  93. turtle.up()
  94. turtle.drop()
  95. else
  96. turtle.select(14)
  97. if turtle.compare() then
  98. turtle.select(10)
  99. turtle.up()
  100. turtle.drop()
  101. else
  102. turtle.select(15)
  103. if turtle.compare() then
  104. turtle.select(11)
  105. turtle.up()
  106. turtle.drop()
  107. else
  108. turtle.select(16)
  109. if turtle.compare() then
  110. turtle.elect(12)
  111. turtle.up()
  112. turtle.drop()
  113. else
  114. print ("There is an error. The block identifyer for the THIRD chest is not included in the system. Console will ignore this batch and continue sorting.")
  115. turtle.up()
  116. end
  117. end
  118. end
  119. end
  120. turtle.up()
  121. turtle.up()
  122.  
  123.  
  124.  
  125. turtle.select(13)
  126. if turtle.compare() then
  127. turtle.select(9)
  128. turtle.up()
  129. turtle.drop()
  130. else
  131. turtle.select(14)
  132. if turtle.compare() then
  133. turtle.select(10)
  134. turtle.up()
  135. turtle.drop()
  136. else
  137. turtle.select(15)
  138. if turtle.compare() then
  139. turtle.select(11)
  140. turtle.up()
  141. turtle.drop()
  142. else
  143. turtle.select(16)
  144. if turtle.compare() then
  145. turtle.select(12)
  146. turtle.up()
  147. turtle.drop()
  148. else
  149. print ("There is an error. The block identifyer for the FOURTH chest is not included in the system. Console will ignore this batch and continue sorting.")
  150. turtle.up()
  151. end
  152. end
  153. end
  154. end
  155.  
  156. turtle.turnRight()
  157. turtle.turnRight()
  158. turtle.forward()
  159. turtle.turnLeft()
  160. turtle.turnLeft()
  161.  
  162. turtle.down()
  163. turtle.down()
  164. turtle.down()
  165. turtle.down()
  166. turtle.down()
  167. turtle.down()
  168. turtle.down()
  169. turtle.down()
  170. turtle.down()
  171. turtle.down()
  172.  
  173. afterFuel = turtle.getFuelLevel()
  174. totalUsedFuel = beforeFuel-afterFuel
  175.  
  176. print ("Sorting sucsessful!")
  177. print ("========================")
  178. print ("Fuel started with: | " .. beforeFuel)
  179. print ("Fuel ended with: | " .. afterFuel)
  180. print ("--------------------+---")
  181. print ("Total used fuel: | " .. totalUsedFuel)
  182. print ("========================")
  183. print ("||||||||||||||||||||||||")
  184. end
Advertisement
Add Comment
Please, Sign In to add comment