Guest User

test01

a guest
Feb 13th, 2013
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.31 KB | None | 0 0
  1. x = 0
  2. z = 0
  3. bbx = 0
  4. bbz = 0
  5. dx = 10
  6. dz = 10
  7.  
  8. -- Funcion Fuel
  9.  
  10. function fuel()
  11.  
  12.         -- miramos inventario para chequear fuel
  13.         turtle.select(1)
  14.         a = 0
  15.         for a = 2,16 do
  16.                 if turtle.compareTo(a) then
  17.                                        
  18.                     -- compruebo items primer slot, muevo y recargo fuel.
  19.                     turtle.select(1)
  20.                    
  21.                     if turtle.getItemCount(1) < 10 then
  22.                         -- Transfers 32 items from the selected slot to slot 6.
  23.                         -- turtle.transferTo(6, 32)
  24.                         -- turtle.transferTo(slot destino,cantidad)
  25.                         -- Cogemos un carbon del slot selecionado turtle.select(a) y lo ponemos en slot (1)
  26.                         turtle.select(a)   
  27.                         turtle.transferTo(1, 1)
  28.                                                
  29.                     end
  30.                
  31.                 end
  32.         end
  33.    
  34.     if turtle.getFuelLevel() < 1 then
  35.         turtle.refuel(1)
  36.     end
  37.        
  38. end
  39.  
  40. -- Funcion cavax
  41.  
  42. function cavax()
  43.  
  44. x = x + 1
  45. turtle.dig()
  46. turtle.forward()
  47.  
  48.     if x == dx then
  49.         x = 0
  50.         z = z + 1
  51.        
  52.         for bbx = 1,dx do
  53.             turtle.back()
  54.         end
  55.        
  56.         cavaz()
  57.     end
  58.  
  59. end
  60.  
  61. -- Funcion cavaz
  62.  
  63. function cavaz()
  64.  
  65. if z == dz then
  66.         z = 0
  67.         turtle.turnLeft()
  68.        
  69.         for bbz = 1,dz do
  70.             turtle.forward()
  71.         end
  72.        
  73.         turtle.turnRight() 
  74.         os.shutdown()
  75.        
  76.     end
  77.  
  78.     turtle.turnRight()
  79.     turtle.dig()
  80.     turtle.forward()
  81.     turtle.turnLeft()
  82.        
  83. end
  84.  
  85. -- Empezamos el programa
  86.  
  87. while true do
  88.  
  89.     fuel()
  90.     cavax()
  91.    
  92. end
Advertisement
Add Comment
Please, Sign In to add comment