albertost85

planta2

Sep 18th, 2021 (edited)
707
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Script to plant trees in minecraft world
  2.  
  3. tiempoAgua=150
  4. tiempoAgua2=120
  5. shell.run("clear")
  6. os.loadAPI("tortu")
  7. pimpoLleno = false
  8. print("Please put log in slot 1 and sapplings in slot 16")
  9. print("Number of files to plant?")
  10. local numFilas = tonumber(io.read())
  11. numFilas = numFilas + 0
  12. print("Number of columns to plant?")
  13. local numCols = tonumber(io.read())
  14. numCols = numCols +0
  15.  
  16.  
  17.  
  18. -- A la posicion
  19. turtle.turnLeft()
  20. for i=1,7 do
  21.   tortu.avanza()
  22. end
  23. turtle.turnRight()
  24. for i=1,12 do
  25.   tortu.avanza()
  26. end
  27. for j=1, numCols do
  28.   for i=1,numFilas do
  29.     if(i == 1) then
  30.     else
  31.       tortu.avanza(6)
  32.     end
  33.     turtle.turnRight()
  34.     turtle.select(1)
  35.     if turtle.compare() then
  36.       tortu.tala()
  37.       turtle.select(16) turtle.place()
  38.     end
  39.     turtle.turnLeft()
  40.     print("Terminada fila "..i.." columna "..j)
  41.   end
  42.  
  43. -- Recoge pimpollos
  44.   tortu.avanza(2)
  45.   turtle.turnRight()
  46.   tortu.avanza(3)
  47.   turtle.turnRight()
  48.   tortu.suca(5,numFilas*6-1)
  49.   turtle.turnRight()
  50.   tortu.avanza(3)
  51.   turtle.turnLeft()
  52.   tortu.avanza(2)
  53.   turtle.turnLeft()
  54.   turtle.turnLeft()
  55.  
  56. -- Giro entre columnas
  57.  
  58.   if(j<numCols) then
  59.     tortu.avanza()
  60.     if(j%2 == 0) then
  61.       turtle.turnLeft()
  62.       tortu.avanza(4)
  63.       turtle.turnLeft()
  64.     else
  65.       turtle.turnRight()
  66.       tortu.avanza(8)
  67.       turtle.turnRight()
  68.     end
  69.     tortu.avanza()
  70.   end
  71. end
  72.  
  73. -- Volver a la posición de inicio por una ruta segura.
  74. if(numCols %2 == 0) then
  75.     tortu.avanza()
  76.     turtle.turnRight()
  77.     tortu.avanza(6*(numCols-1) + 2)
  78.     turtle.turnLeft()
  79.     tortu.avanza(6*(1+1) - 1)
  80. else
  81.     tortu.avanza()
  82.     turtle.turnLeft()
  83.     tortu.avanza(6*(numCols-1))
  84.     turtle.turnLeft()
  85.     tortu.avanza(6*(numFilas+1) +1)
  86. end
  87. turtle.turnLeft()
  88. tortu.avanza(7)
  89.  
  90. -- Inventario
  91. tronco = turtle.getItemDetail(1)
  92. pimpollo = turtle.getItemDetail(16)
  93.  
  94. turtle.turnRight()
  95. tortu.avanza(2)
  96. turtle.turnLeft()
  97. turtle.turnLeft()
  98.  
  99. turtle.select(1)
  100. item = turtle.getItemDetail(1)
  101. turtle.turnRight()
  102. turtle.drop(item.count-1)
  103. turtle.turnLeft()
  104. for inventory = 2,15 do
  105.   turtle.select(inventory)
  106.   item = turtle.getItemDetail(inventory)
  107.   if(item == nil) then
  108.     print("Slot "..inventory.." vacío.")
  109.   elseif(item.name == tronco.name) then
  110.     turtle.turnRight()
  111.    
  112.     turtle.drop()
  113.     turtle.turnLeft()
  114.   elseif(item.name == pimpollo.name) then
  115.     if(turtle.getItemCount(16)<64) then
  116.       turtle.transferTo(16)
  117.     end
  118.     if(turtle.getItemCount(inventory)>0) then
  119.       turtle.turnLeft()
  120.       turtle.drop()
  121.       turtle.turnRight()
  122.     end
  123.   else
  124.     turtle.dropUp()
  125.   end
  126. end
  127. tortu.avanza(2)
  128.  
  129.  
  130.  
RAW Paste Data