Advertisement
koki2000

glass placer

Oct 16th, 2015
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 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.placeDown()
  23. turtle.forward()
  24. elseif turtle.getItemCount(9) < 1 then
  25. print("nincs cucc az inventorymban")
  26. local event, key = os.pullEvent("key")
  27. end
  28. end
  29.  
  30. function input()
  31. if ertek == 0 then
  32. print("mennyit menjek elore")
  33. ertek = read()
  34. ertek = ertek + 0
  35. end
  36.  
  37. if circle == 0 then
  38. print("hany korben?")
  39. circle = read()
  40. circle = circle + 0
  41. vege = circle
  42. end
  43. end
  44.  
  45. function main()
  46. for i = 1, ertek do
  47. slotsel()
  48. dig()
  49. if i == ertek then
  50. turtle.turnLeft()
  51. turtle.forward()
  52. turtle.turnLeft()
  53. turtle.forward()
  54. end
  55. end
  56.  
  57. for j = 1, ertek do
  58. slotsel()
  59. dig()
  60. if j == ertek then
  61. turtle.turnRight()
  62. turtle.forward()
  63. turtle.turnRight()
  64. vege = vege - 1
  65. if vege == 0 then
  66. run = false
  67. end
  68. end
  69. end
  70. end
  71.  
  72. while run do
  73. input()
  74. main()
  75. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement