Guest User

CC Turtle Storage System

a guest
Oct 21st, 2015
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.53 KB | None | 0 0
  1. turtle.select(16)
  2. side=4
  3. pathLength=5
  4. while true do
  5. print("welches item soll ich suchen?")
  6. id=io.read()
  7. print("wie viel davon?")
  8. amount=io.read()
  9. gotItem=false
  10. x=0
  11. while gotItem=false or x<=pathlength do
  12. turtle.placeDown()
  13. s=peripheral.wrap("bottom")
  14. if s.list(side)[id]>=amount then
  15. s.extract(side,id,1,amount)
  16. gotItem=true
  17. else
  18. if s.list(side)[id]>0 then
  19. amount=amount-s.list(side)[id]
  20. s.extract(side,id,1,s.list(side)[id])
  21. end
  22. end
  23. x=x+1
  24. turtle.digDown()
  25. turtle.forward()
  26. end
  27. while x>=0 do
  28. turtle.back()
  29. end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment