roflmuffin

Untitled

Dec 20th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. charger = peripheral.wrap("front")
  2.  
  3. function retrieveQuartz()
  4. turtle.select(16)
  5. turtle.suck()
  6. end
  7.  
  8. function pushQuartz()
  9. turtle.dropUp()
  10. end
  11.  
  12. function placeQuartz()
  13. turtle.select(1)
  14. turtle.drop(1)
  15. end
  16.  
  17. function isCharged()
  18. itemName = charger.getStackInSlot(1).raw_name
  19. if string.match(itemName, "charged") then
  20. return true
  21. else
  22. return false
  23. end
  24. end
  25.  
  26. function isEmpty()
  27. if (charger.getStackInSlot(1) == null) then
  28. return true
  29. else
  30. return false
  31. end
  32. end
  33.  
  34. function isFirstSlotEmpty()
  35. if (turtle.getItemCount(1) == 0) then
  36. return true
  37. else
  38. return false
  39. end
  40. end
  41.  
  42. while true do
  43. if (isEmpty() and not isFirstSlotEmpty()) then
  44. placeQuartz()
  45. end
  46.  
  47. if (not isEmpty() and isCharged()) then
  48. retrieveQuartz()
  49. end
  50.  
  51. os.sleep(0.1)
  52. end
Add Comment
Please, Sign In to add comment