Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Minecraft - ComputerCraft - Automatic Mining Turtle

By: a guest on Mar 18th, 2012  |  syntax: Lua  |  size: 2.41 KB  |  views: 14,832  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. --[[
  2.  
  3. ---------------------
  4.  
  5. v1.1
  6.  
  7. Change log:
  8.  
  9. 1.0 -
  10. + Creation
  11. + Scripting
  12. 1.1 -
  13. + Publishing
  14.  
  15. ---------------------
  16.  
  17. This is made for ComputerCraft 1.31+. It allows Mining Turtles to dig a 5x2 hole all the way to bedrock and fly back up again!
  18.  
  19. Thanks for using and enjoy!
  20.  
  21. Under the Create Commons license
  22. Made by YaYaBinks3
  23.  
  24. ---------------------
  25.  
  26. INSTRUCTIONS FOR USE;
  27. 1. Create a Mining Turtle on Minecraft, place it,
  28. 2. Open the Mining Turtle, give him 3 TORCHES AND MAKE SURE THEY ARE IN THE BOX THAT IS SELECTED (The box is at the right hand side) and then type 'id',
  29. 3. Minimize Minecraft and open up Documents, next go to %appdata%\Roaming\.minecraft\saves\YOURLEVEL\computer
  30. 4. Find the file called the number that was specified when you typed 'id',
  31. 5. Double click the file,
  32. 6. Add a new text document,
  33. 7. Copy the code below, and paste it in,
  34. 8. Maximize Minecraft
  35. 9. Go to the Mining Turtle
  36. 10. Type in 'rename dig.txt dig'
  37. 11. Type in 'dig'
  38. 12. Now watch it do it's thing.
  39.  
  40. ---------------------
  41.  
  42. --]]
  43.  
  44. --Quite simple, but yet effective.
  45.  
  46.  
  47. while true do
  48.  
  49. for i=1, 120 do --The real bedrock layer is 127, but 120 so he doesn't clash with the bedrock and stop working.
  50.  
  51. turtle.up() --Goes up.
  52. turtle.dig() --Digs forward
  53. turtle.down() --Goes down
  54. turtle.dig() --Digs forward
  55. turtle.place() --Places a torch. (Remember to give him torches.)
  56.  
  57. --Now, you may wonder what that does. The Mining Turtle basicly digs a hole, places a torch and when that loops the Mining Turtle removes the torch, digs a hole below where the other torch was and places a new one, then carries on.
  58.  
  59. turtle.turnRight() --Turns right.
  60. turtle.digDown() --Digs down.
  61. turtle.down() --Goes down.
  62. turtle.dig() --(Here comes the real thing) Digs forward
  63. turtle.forward() --Goes forward
  64. turtle.dig() --Do I have to type any more?
  65. turtle.forward()
  66. turtle.dig()
  67. turtle.forward()
  68. turtle.dig()
  69. turtle.forward()
  70. turtle.dig()
  71. turtle.forward()
  72. turtle.turnRight()
  73. turtle.dig()
  74. turtle.forward()
  75. turtle.turnRight()
  76. turtle.dig()
  77. turtle.forward()
  78. turtle.dig()
  79. turtle.forward()
  80. turtle.dig()
  81. turtle.forward()
  82. turtle.dig()
  83. turtle.forward()
  84. turtle.dig()
  85. turtle.forward()
  86. turtle.turnRight() --Back to where he started, so then he turns right to start again.
  87. turtle.forward() --Goes finally forward!
  88.  
  89. end
  90.  
  91. --Once he's reached the bedrock layer, he flies back up.
  92.  
  93. for i=1,120 do
  94.  
  95. turtle.up()
  96.  
  97. end  
  98. end