Advertisement
koki2000

Untitled

Oct 19th, 2015
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.41 KB | None | 0 0
  1. local run = true
  2. local slot = 1
  3. local ertek = 0
  4. local circle = 0
  5. local vege = 0
  6.  
  7. function slotsel()
  8. turtle.select(slot)
  9. if turtle.getItemCount(slot) < 1 then
  10. slot = slot + 1
  11. turtle.select(slot)
  12. if slot == 9 and turtle.getItemCount(slot) < 1 then
  13. run = false
  14. slot = 1
  15. end
  16. end
  17. end
  18.  
  19.  
  20. function dig()
  21. if turtle.getItemCount(9) > 0 then
  22. turtle.turnLeft()
  23. turtle.placeDown()
  24. turtle.turnRight()
  25. turtle.forward()
  26. elseif turtle.getItemCount(9) < 1 then
  27. print("nincs cucc az inventorymban")
  28. local event, key = os.pullEvent("key")
  29. end
  30. end
  31.  
  32. function digvissza()
  33. if turtle.getItemCount(9) > 0 then
  34. turtle.turnLeft()
  35. turtle.placeDown()
  36. turtle.turnRight()
  37. turtle.forward()
  38. elseif turtle.getItemCount(9) < 1 then
  39. print("nincs cucc az inventorymban")
  40. local event, key = os.pullEvent("key")
  41. end
  42. end
  43.  
  44. function input()
  45. if ertek == 0 then
  46. print("mennyit menjek elore")
  47. ertek = read()
  48. ertek = ertek + 0
  49. end
  50.  
  51. if circle == 0 then
  52. print("hany korben?")
  53. circle = read()
  54. circle = circle + 0
  55. vege = circle
  56. end
  57. end
  58.  
  59. function main()
  60. for i = 1, ertek do
  61. slotsel()
  62. dig()
  63. if i == ertek then
  64. turtle.turnLeft()
  65. turtle.up()
  66. turtle.forward()
  67. turtle.turnLeft()
  68. end
  69. end
  70.  
  71. for j = 1, ertek do
  72. slotsel()
  73. digvissza()
  74. if j == ertek then
  75. turtle.turnRight()
  76. turtle.turnUp()
  77. turtle.up()
  78. turtle.turnRight()
  79. vege = vege - 1
  80. if vege == 0 then
  81. run = false
  82. end
  83. end
  84. end
  85. end
  86.  
  87. while run do
  88. input()
  89. main()
  90. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement