Shadow_Assailant

Shadow_Assailant's Dark Iron Forge

Jun 19th, 2013
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Shadow_Assailant's Dark Iron Forge--
  2. --v3.0--
  3.  
  4. local function checkInv() -- Searches for a slot with items and bypasses empty inventory slots
  5.   turtle.select(b)
  6.   if turtle.getItemCount(b)==0 then  
  7.     repeat  
  8.       b = b + 1
  9.       turtle.select(b)
  10.     until turtle.getItemCount(b)>0
  11.   end
  12. end
  13.  
  14. local function transfering()
  15.   local l = turtle.getItemCount(16)
  16.   repeat
  17.     if turtle.getItemCount(z)<64 then
  18.       local s = turtle.getItemSpace(z)
  19.       turtle.select(16)
  20.       turtle.transferTo(z,s)
  21.       l = l - s
  22.       z = z + 1
  23.     else
  24.       z = z + 1
  25.     end
  26.   until l<=0
  27. end
  28.  
  29. local function wait()
  30.   m = m + 1
  31.   if m >= 10 then
  32.     term.clear()
  33.     term.setCursorPos(1,1)
  34.     print("Must let Wrath Fire regrow!")
  35.     print("Sleeping...")
  36.     sleep(90)
  37.     term.clear()
  38.     term.setCursorPos(1,1)
  39.     print("Resuming work!")    
  40.     term.setCursorPos(1,1)
  41.     m = 0
  42.   end
  43. end
  44.  
  45. while true do
  46.   b = 1
  47.   z = 1
  48.   m = 0
  49.   q = 0
  50.   for f = 1, 15 do
  51.     term.clear()
  52.     term.setCursorPos(1,1)
  53.     if turtle.getItemCount(f)>0 or turtle.getItemCount(16)>0 then
  54.       term.setCursorPos(1,1)
  55.       print("Creating Dark Iron!")
  56.       term.setCursorPos(1,1)
  57.       q = q + turtle.getItemCount(f)
  58.       if turtle.getItemCount(16)>0 and q>=897 then -- If the inventory is FULL of Iron, there needs to be space for the Dark Iron, so it creates 1 slot for space
  59.         turtle.select(16)
  60.         turtle.drop()
  61.         turtle.select(1)
  62.       elseif turtle.getItemCount(16)>0 and q<897 then
  63.         q = q + turtle.getItemCount(16)
  64.         transfering()
  65.         turtle.select(1)
  66.       end
  67.       turtle.turnRight()
  68.       turtle.turnRight()
  69.       while q>0 do
  70.         checkInv()  
  71.         turtle.place()
  72.         sleep(3)
  73.         turtle.dig()
  74.         wait(m)
  75.         q = q - 1 -- One less block of regular iron, so must take that into account
  76.       end
  77.       turtle.turnRight()
  78.       turtle.turnRight()
  79.       for t = 1, 16 do  
  80.         turtle.select(t)
  81.         turtle.drop()
  82.       end
  83.       turtle.select(1)
  84.     else
  85.       b = 1
  86.       z = 1
  87.       m = 0
  88.       q = 0
  89.       term.clear()
  90.       sleep(1) -- Will wait until I give it iron      
  91.       print("Waiting!")
  92.       sleep(1)
  93.       term.setCursorPos(1,1)
  94.     end
  95.   end  
  96. end
Advertisement
Add Comment
Please, Sign In to add comment