Cwmwd24

NetherTower

Mar 14th, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.48 KB | None | 0 0
  1. -- -------------------------------------------------------------------------- --
  2. -- NetherTower : RRMkQrvf
  3. --
  4. -- Turtle script to build a 3x3 tower to the Nether ceiling -- beware of falling
  5. -- lava!!!
  6. --
  7. -- -------------------------------------------------------------------------- --
  8. --
  9. -- INVENTORY:
  10. -- [1][2][3][4]
  11. -- [5][6][7][8]
  12. -- [9][A][B][C]
  13. -- [D][E][F][0]
  14. --
  15. -- 1 : Fuel
  16. -- Rest should be tower material.
  17. --
  18. -- -------------------------------------------------------------------------- --
  19.  
  20. local tArgs = { ... }
  21. local height = 0
  22.  
  23. local function PrintHelp()
  24.   print( "Usage:" )
  25.   print( "NetherTower <height>" )
  26.   print( "  height -- starting height of turtle." )
  27.   return
  28. end
  29.  
  30. local function CheckFuel()
  31.   if turtle.getFuelLevel() < 64 and turtle.getItemCount( 1 ) > 1 then
  32.     turtle.select( 1 )
  33.     turtle.refuel( 1 )
  34.   end
  35.   return
  36. end
  37.  
  38. -- Check the commandline
  39. if not #tArgs == 1 then
  40.   PrintHelp()
  41.   return
  42. end
  43.  
  44. if tArgs[ 1 ] > "0" then
  45.   height = tArgs[ 1 ]
  46. else
  47.   PrintHelp()
  48.   return
  49. end
  50.  
  51.  
  52. -- Start with main shaft.
  53. for step = height, 128 do
  54.   while turtle.detectUp() do
  55.     turtle.digUp()
  56.   end
  57.   CheckFuel()
  58.   turtle.up()
  59.   if not turtle.detect() then
  60.     turtle.select( 2 )
  61.     turtle.place()
  62.   end
  63. end
  64. turtle.turnLeft()
  65. if not turtle.detect() then
  66.   turtle.select( 2 )
  67.   turtle.place()
  68. end
  69. for step = height, 128 do
  70.   turtle.down()
  71.   if not turtle.detect() then
  72.     turtle.select( 2 )
  73.     turtle.place()
  74.   end
  75. end
Advertisement
Add Comment
Please, Sign In to add comment