Facebook
From Coral Finch, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 164
  1. function refuel()
  2.         if turtle.getFuelLevel() < 10 then
  3.         turtle.select(16)
  4.         turtle.refuel(1)
  5.         end
  6. end
  7.  
  8. function moveForward()
  9.         repeat
  10.         turtle.dig()
  11.         until turtle.forward()
  12. end
  13.  
  14. function clear()
  15.         local z = 0
  16.         if turtle.detectUp() then
  17.                 while turtle.detectUp() do
  18.                         repeat
  19.                         turtle.digUp()
  20.                         until turtle.up()
  21.                         z = z+1
  22.                 end
  23.                         repeat
  24.                         turtle.down()
  25.                         z = z-1
  26.                                 if z < 0 then
  27.                                         repeat
  28.                                         turtle.up()
  29.                                         z = z+1
  30.                                         until z == 0
  31.                                 end
  32.                         until z == 0
  33.         end
  34. end
  35.  
  36. function test()
  37.         turtle.select(15)
  38.                 if turtle.detectDown() then
  39.                         turtle.digDown()
  40.                 end
  41.                 if not turtle.placeDown() then
  42.                         turtle.digDown()
  43.                         turtle.down()
  44.                         turtle.digDown()
  45.                         turtle.select(14)
  46.                         turtle.placeDown()
  47.                         turtle.up()
  48.                 end
  49.         turtle.digDown()
  50. end
  51.  
  52. print "How wide is this foundation?"
  53.         x = tonumber(read())
  54. print "How long?"
  55.         y = tonumber(read())
  56. print "Please place fuel in slot 16, two torches in slot 15, and dirt/stone in 14. Press any key to start."
  57.         os.pullEvent("key")
  58.  
  59.         x = x-1
  60.         y = y/2
  61.  
  62. refuel()
  63. turtle.turnLeft()
  64. turtle.digUp()
  65. turtle.up()
  66. for i = 1,x/2 do
  67.         test()
  68.         clear()
  69.         moveForward()
  70.         refuel()
  71. end
  72. turtle.turnLeft()
  73. turtle.turnLeft()
  74. for i = 1,x do
  75.         test()
  76.         clear()
  77.         moveForward()
  78.         refuel()
  79. end
  80.  
  81. for i = 1,y+0.5 do
  82.         turtle.turnLeft()
  83.         test()
  84.         clear()
  85.         moveForward()
  86.         refuel()
  87.         turtle.turnLeft()
  88.         for i = 1,x do
  89.                 test()
  90.                 clear()
  91.                 moveForward()
  92.                 refuel()
  93.         end
  94.         turtle.turnRight()
  95.         test()
  96.         clear()
  97.         moveForward()
  98.         refuel()
  99.         turtle.turnRight()
  100.         for i = 1,x do
  101.                 test()
  102.                 clear()
  103.                 moveForward()
  104.                 refuel()
  105.         end
  106. end
  107. test()
  108. clear()