Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- vertMine v1 by bigougit
- This program is for turtles only,
- ideally mining turtles.
- To install in-game, make sure
- that http = true in your
- computercraft config.
- To install, open your turtle
- and type:
- pastebin get RbRkXpCa vertMine
- Usage: turtle will dig a straight
- tunnel a set distance of a set
- height. Edit depth and distance
- variables below as desired.
- REMEMBER TO PUT AN ENDER CHEST
- IN SLOT 1 OR TURTLE WILL THROW
- ITEMS ON GROUND.
- THIS PROGRAM DOES NOT CHECK FOR
- FUEL OR REFUEL THE TURTLE. MAKE
- SURE TURTLES HAVE PLENTY OF FUEL
- BEFORE STARTING!
- report any errors to me on youtube or
- twitter.
- http://youtube.com/user/bigougit
- http://twitter.com/bigougit
- --]]
- -- how far up or down to dig
- local depth = 70
- -- how far away to dig
- local distance = 100
- local traveled = 0
- function tryUp()
- local trys = 0
- while not turtle.up() do
- turtle.digUp()
- turtle.attackUp()
- trys = trys + 1
- if trys >= 20 then
- return false
- end
- end
- return true
- end
- function tryDown()
- local trys = 0
- while not turtle.down() do
- turtle.digDown()
- turtle.attackDown()
- trys = trys + 1
- if trys >= 20 then
- return false
- end
- end
- return true
- end
- function tryForward()
- local trys = 0
- while not turtle.forward() do
- turtle.dig()
- turtle.attack()
- trys = trys + 1
- if trys >= 20 then
- return false
- end
- end
- return true
- end
- --return how many items in [slot]
- local function sCount(slot)
- return turtle.getItemCount(slot)
- end
- function haveRoom()
- local hasRoom = false
- for i=1,16 do
- if sCount(i) == 0 then
- hasRoom = true
- end
- end
- return hasRoom
- end
- function checkInventory()
- if not haveRoom() then
- turtle.select(1)
- while not turtle.placeUp() do
- turtle.digUp()
- turtle.attackUp()
- end
- for i=2,16 do
- turtle.select(i)
- while not turtle.dropUp() do
- sleep(0.5)
- end
- end
- turtle.select(1)
- turtle.digUp()
- end
- end
- -- start of main
- while traveled < distance do
- while tryDown() do
- checkInventory()
- end
- if tryForward() then
- traveled = traveled + 1
- end
- for i=1,depth do
- if not tryUp() then
- print("HELP! IM STUCK!")
- sleep(400)
- end
- checkInventory()
- end
- if tryForward() then
- traveled = traveled + 1
- end
- end
- turtle.turnLeft()
- turtle.turnLeft()
- for i=1, traveled do
- tryForward()
- end
Advertisement
Add Comment
Please, Sign In to add comment