Advertisement
Guest User

Turtle Paste

a guest
Mar 3rd, 2015
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- This program will works only with a Minium Stone provided in the first slot of a crafty turtle
  2. -- exactly in this setup http://tinypic.com/r/16c71w8/6
  3. -- The stone never worns out, you can stress the crafty placing blaze powders in every slot while it      -- works, no matter. Only don't put blaze powder in slot 16 or they'll return to macerator!
  4. -- Note: this program will become obsolete when they'll fix the turtle.drop() and turtle.suck() commands
  5. -- that afflicts CC 1.5, but will work anyway.
  6. -- WARNING: You have to put AT LEAST 10 powders in crafty's inventory or in the chest below.
  7.  
  8. tWait = 5 -- A higher value will slow down the turtle, just for th sake of your little generator
  9. goodstack = 30 -- Numbers of blaze that the turtle will TRY to process in one load.
  10.                -- It needs at least 10, but will go faster with higher stacks: raise this value and
  11.                -- fill the chest below with 4 stacks (depending on macerator upgrades) for top speed.
  12.                
  13. local function getcount()
  14.     numstack2 = turtle.getItemCount (2)
  15.     numstack3 = turtle.getItemCount (3)
  16.     numstack16 = turtle.getItemCount (16)
  17.     sleep (0.1)  
  18. end
  19.  
  20. local function destroy()
  21.     for x = 4,15 do  
  22.         turtle.select(x)
  23.         turtle.dropUp()
  24.             sleep (0.1)
  25.     end
  26.  end
  27.  
  28. local function seek()
  29.     for x = 4, 15 do    
  30.         if turtle.getItemCount (x) > 0 and
  31.             forbidden == false then
  32.             forbidden = true
  33.             destroy()
  34.             forbidden = false
  35.             sleep (0.1)    
  36.         end
  37.     end
  38. end
  39.  
  40. while true do
  41.     forbidden = false
  42.     seek()
  43.     sleep (0.1)
  44.     if forbidden == false then
  45.         getcount ()
  46.         if numstack2 == 0 and
  47.         numstack3 == 0 then        
  48.             turtle.select (2)
  49.             turtle.suckDown()
  50.             numstack2div = turtle.getItemCount (2) / 2
  51.             turtle.transferTo (3, numstack2div)
  52.             getcount()     
  53.         elseif numstack2 > numstack3 or
  54.             numstack2 < numstack3 then     
  55.                 turtle.select (3)
  56.                 turtle.transferTo (2, numstack3)
  57.             turtle.dropUp()
  58.             turtle.select (2)
  59.             numstack2div = turtle.getItemCount (2) / 2
  60.             turtle.transferTo (3, numstack2div)
  61.             getcount()         
  62.             if numstack2 == numstack3 + 1 then       
  63.                 turtle.select (2)
  64.                 turtle.transferTo (4, 1)
  65.                 getcount()     
  66.             else end           
  67.         elseif numstack2 == numstack3 and
  68.             numstack2 >= 5 then    
  69.                 turtle.select (16)
  70.                 turtle.craft()
  71.                 turtle.dropUp()
  72.                 turtle.craft()
  73.                 turtle.dropUp()
  74.             turtle.craft()
  75.                 turtle.dropUp()
  76.                 turtle.craft()
  77.                 turtle.dropUp()
  78.             turtle.craft()
  79.             turtle.dropUp()
  80.                 getcount()     
  81.         elseif numstack2 == numstack3 and
  82.             numstack2 < 5 then     
  83.             turtle.select (3)
  84.             turtle.transferTo (2, numstack3)
  85.             turtle.select (2)
  86.             turtle.suckDown()
  87.             print ("Acquiring Blaze Powders...")
  88.             getcount()     
  89.             if numstack2 < goodstack then      
  90.                     print ("It needs more Blaze Powders!")
  91.                     sleep (tWait)
  92.                     turtle.select (2)
  93.                     turtle.suckDown()
  94.                     term.clear()
  95.                     term.setCursorPos(1,1)
  96.                     getcount()                 
  97.             else end
  98.         elseif numstack16 > 0 then
  99.                 turtle.select (16)
  100.                 turtle.dropUp()
  101.                 turtle.select (2)
  102.                 getcount()
  103.         else forbidden = true            
  104.         end                    
  105.     end
  106. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement