Advertisement
BillBodkin

CC

Dec 25th, 2016
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.01 KB | None | 0 0
  1. print("This program will turf down what is in front of it and make a script to build it")
  2. print("What do you want to call the new script?")
  3. fName = read()
  4. file = fs.open(fName, "w")
  5. print("How far in front of the turtle does the structure go?")
  6. x = read()
  7. print("How far up of the turtle does the structure go?")
  8. y = read()
  9. print("How far to the right of the turtle does the structure go?")
  10. z = read()
  11. blockData = {}
  12. turtle.select(1)
  13. for xi=1,x do
  14.     turtle.forward()
  15.     turtle.turnRight()
  16.     for yi=1,y do
  17.         for zi=1,z do
  18.             blockData[xi] = {}
  19.             blockData[xi][yi] = {}
  20.             if turtle.detect() then
  21.                 blockData[xi][yi][zi] = true
  22.             else
  23.                 blockData[xi][yi][zi] = false
  24.             end
  25.             turtle.dig()
  26.             turtle.forward()
  27.         end
  28.         turtle.turnRight()
  29.         turtle.turnRight()
  30.         for iz=1,z do
  31.             turtle.forward()
  32.         end
  33.         turtle.turnRight()
  34.         turtle.turnRight()
  35.         turtle.up()
  36.     end
  37.     for iy=1,y do
  38.         turtle.down()
  39.     end
  40.     turtle.turnLeft()
  41. end
  42. turtle.turnRight()
  43. turtle.turnRight()
  44. for ix=1,x do
  45.     turtle.forward()
  46. end
  47. turtle.turnRight()
  48. turtle.turnRight()
  49.  
  50. -- now to use the table to make the script
  51. --turtle.up()
  52. for yi=1,y do
  53.     for xi=1,x do
  54.         turtle.forward()
  55.         turtle.turnRight()
  56.         for yi=1,y do
  57.             turtle.up()
  58.             for zi=1,z do
  59.                 if blockData[xi] ~= nil then
  60.                     if blockData[xi][yi] ~= nil then
  61.                         if blockData[xi][yi][zi] == true then
  62.                             while turtle.getItemCount() == 0 do
  63.                                 if turtle.getSelectedSlot() == 16 then
  64.                                     turtle.select(1)
  65.                                 else
  66.                                     turtle.select(turtle.getSelectedSlot())
  67.                                 end
  68.                             end
  69.                             turtle.placeDown()
  70.                         end
  71.                     end
  72.                 end
  73.                 turtle.forward()
  74.             end
  75.             turtle.turnRight()
  76.             turtle.turnRight()
  77.             for iz=1,z do
  78.                 turtle.forward()
  79.             end
  80.             turtle.turnRight()
  81.             turtle.turnRight()
  82.             --turtle.up()
  83.         end
  84.         for iy=1,y do
  85.             turtle.down()
  86.         end
  87.         turtle.turnLeft()
  88.     end
  89.     turtle.turnRight()
  90.     turtle.turnRight()
  91.     for ix=1,x do
  92.         turtle.forward()
  93.     end
  94.     turtle.turnRight()
  95.     turtle.turnRight()
  96. end
  97.  
  98. file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement