guitarplayer616

the rest of schem turtle

Nov 25th, 2016
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3.  
  4.  
  5.  
  6. --[[Navigation Functions]]--
  7.  
  8.  
  9. --[[Refill Functions]]--
  10.  
  11. --[[Schematic Functions]]--
  12.  
  13.  
  14. --[[Movement Functions]]--
  15.  
  16.  
  17.  
  18. --[[Working Functions]]--
  19.  
  20.  
  21. --[[
  22. function run()
  23.     print("Press key to start building...")
  24.     read()
  25.     --invList = scanInv()
  26.  
  27.     up()
  28.     n = 1
  29.     turtle.select(n)
  30.  
  31.     for x=1,height do
  32.         for y=1,width do
  33.             for z=1,length do
  34.                 blockID = getBlockId(x-1,y-1,z-1)
  35.                     blockData = getData(x-1,y-1,z-1)
  36.                     forward()
  37.                 turtle.digDown()
  38.                     slot_lst = slots[blockID][blockData]
  39.                     if(slot_lst ~= nil) then
  40.                         if(#slot_lst > 0) then
  41.                             local found=false
  42.                             for i,v in ipairs(slot_lst) do
  43.                                 if(turtle.getItemCount(v) > 0) then
  44.                                     found=true
  45.                                     turtle.select(v)
  46.                                     break
  47.                                 end
  48.                             end
  49.                             if not found then
  50.                                 print("Not enough " .. getBlockName(blockID, blockData) .. ". Please refill...")
  51.                             refill()
  52.                             end
  53.                             while turtle.getItemCount() == 0 do
  54.                             refill()
  55.                         end
  56.                         if turtle.getFuelLevel() < 200 then
  57.                             refill()
  58.                         end
  59.                         end
  60.                     end
  61.                 end
  62.                 left()
  63.                 forward()
  64.             left()
  65.             for i=1,length do
  66.                 forward()
  67.             end
  68.             right()
  69.             right()
  70.         end
  71.         right()
  72.         for i=1,width do
  73.             forward()
  74.         end
  75.         left()
  76.         up()
  77.     end
  78.  
  79.     for i=1,height+1 do
  80.         down()
  81.     end
  82. end
  83. ]]--
Add Comment
Please, Sign In to add comment