Advertisement
Guest User

Turtle Code

a guest
Sep 15th, 2016
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. Main()
  2.  
  3. function Main()
  4. x = turtle.getFuelLevel()
  5.  
  6. y = turtle.getItemCount(2)
  7.  
  8. z = turtle.getItemCount(3)
  9.  
  10. function turnAround()
  11. turtle.turnLeft()
  12. turtle.turnLeft()
  13. end
  14.  
  15. function restart()
  16. Main()
  17. end
  18.  
  19. print "Booting"
  20. sleep(2)
  21. print " "
  22.  
  23. if x < 16
  24. then
  25. turtle.select(1)
  26. turtle.turnLeft(1)
  27. turtle.suck(1)
  28. turtle.refuel(1)
  29. turtle.turnRight(1)
  30. else
  31. print "Full"
  32. end
  33.  
  34. if x < 16
  35. then
  36. print "Empty"
  37. print "Please Refill"
  38. print "Stopping"
  39. sleep(5)
  40. print "Restartng..."
  41. restart()
  42. else
  43. print " "
  44. end
  45.  
  46. if y ~= 3
  47. then
  48. turtle.select(2)
  49. turnAround()
  50. turtle.suck(3-y)
  51. turnAround()
  52. else
  53. print "Full"
  54. end
  55.  
  56. if turtle.getItemCount(2) ~= 3
  57. then
  58. print "Empty"
  59. print "Please Refill"
  60. print "Stopping"
  61. sleep(5)
  62. print "Restarting..."
  63. restart()
  64. else
  65. print " "
  66. end
  67.  
  68. if z ~= 4
  69. then
  70. turtle.select(3)
  71. turtle.turnRight()
  72. turtle.suck(4-z)
  73. turtle.turnLeft()
  74. else
  75. print "Full"
  76. end
  77.  
  78. if turtle.getItemCount(3) ~= 4
  79. then
  80. print "Empty"
  81. print "Please Refill"
  82. print "Stopping"
  83. sleep(5)
  84. print "Restarting..."
  85. restart()
  86. else
  87. print " "
  88. end
  89.  
  90. print "Calculating Supply Count"
  91. sleep(2.5)
  92. print " "
  93.  
  94. if x < 16 and y = 3 and z = 4
  95. then
  96. Print "Ready"
  97. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement