Advertisement
ecco7777

CC Turtle Storage System

Oct 21st, 2015
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. turtle.select(16)
  2. side=4
  3. pathLength=5
  4. while true do
  5. print("Welche ID hat das Item")
  6. id=tonumber(io.read())
  7. print("Wie viel davon soll ich suchen?")
  8. amount=tonumber(io.read())
  9. gotItem=false
  10. x=0
  11. while gotItem==false and x<=pathLength do
  12. turtle.placeDown()
  13. s=peripheral.wrap("bottom")
  14. if s.list(side)~=nil then
  15. if s.list(side)[id]~=nil then
  16. if s.list(side)[id]>=amount then
  17. s.extract(side,id,1,amount)
  18. gotItem=true
  19. else
  20. if s.list(side)[id]>0 then
  21. amount=amount-s.list(side)[id]
  22. s.extract(side,id,1,s.list(side)[id])
  23. end
  24. end
  25. end
  26. end
  27. x=x+1
  28. turtle.digDown()
  29. turtle.forward()
  30. end
  31. while x>=1 do
  32. turtle.back()
  33. x=x-1
  34. end
  35. if gotItem==false then print("Nicht genug Items") end
  36. if gotItem==true then print("Bitte sehr") end
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement