Advertisement
Guest User

ClearArea

a guest
Aug 12th, 2013
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.32 KB | None | 0 0
  1. local tArgs = {...}
  2. tArgs[2] = tonumber(tArgs[2])
  3.  
  4. term.clear()
  5. term.setCursorPos(1,1)
  6. print("Digging:")
  7. print("  "..tArgs[1].." blocks Down")
  8. print("  "..tArgs[2].." blocks Forward")
  9. print("  "..tArgs[3].." blocks Side")
  10. term.setCursorPos(18, 9)
  11. textutils.slowPrint("made by okok99haha")
  12.  
  13. function fuel()
  14.   while turtle.getFuelLevel() < 20 do
  15.   turtle.select(16)
  16.   turtle.refuel()
  17.   turtle.select(1)
  18.  end
  19. end
  20.  
  21. function down()
  22. for i = 1, tArgs[1]-1 do
  23.   while not turtle.down()
  24.     do turtle.digDown()
  25.  end
  26.   turtle.digDown()
  27. end
  28. end
  29.  
  30. function up()
  31. for i = 1, tArgs[1]-1 do
  32.   while not turtle.up()
  33.     do turtle.digUp()
  34.  end
  35. end
  36. end
  37.  
  38. function forward()
  39.   while not turtle.forward()
  40.     do turtle.dig()
  41.  end
  42. end
  43.  
  44. function line()
  45.   for aa = 1, tArgs[2] do
  46.     down()
  47.     up()
  48.   if aa < tArgs[2] then
  49.     forward()
  50.    end
  51.  end
  52. end
  53.  
  54. function turn()
  55.   turtle.turnRight()
  56.   turtle.turnRight()
  57. end
  58.  
  59. function back()
  60.   for ab = 1, tArgs[2]-1 do
  61.     turtle.forward()
  62.  end
  63. end
  64.  
  65. function moveLine()
  66.   turtle.turnLeft()
  67.   turtle.dig()
  68.   turtle.forward()
  69.   turtle.turnLeft()
  70. end
  71.  
  72. for i = 1, tArgs[3] do
  73.   fuel()
  74.   line()
  75.   turn()
  76.   back()
  77.   moveLine()
  78. end
  79.  
  80. term.setCursorPos(1,11)
  81. print("Done!")
  82. print("Print Any Key to Exit")
  83. os.pullEvent("key")
  84. term.clear()
  85. term.setCursorPos(1,1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement