Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Pastebin code: iCTwXr3T
- --For people like stray, that only read the top of the code, and then gives up...
- --if you didn't give up already, look below Straymav xD
- --Put coal in slot #16, torches #15, ender chest for dropping items #14
- --Also put a chest behind the turtle, if you want it to drop the loot it finds
- --Put a chest to the left of the turtle, to resupply it with torches
- --Info about the Default mode:
- --the cycles it will run is 20
- --You can still choose what the branch-lenght is! using the "stripmine <number>"
- --It uses/tries to use torches
- --It uses/tries to use chests
- --It digs in Speed-Mode
- --It uses Wait-mode
- --It has 2 spaces between each tunnel
- --It goes back to the starting position, when done
- --The space between the torches is 6
- --end
- shell.run("clear")
- term.setCursorPos(1, 1)
- local tArgs = {...}
- if #tArgs > 1 or #tArgs < 1 then
- print("I need 1 argument, for the branch-lenght")
- print("so feks. write: stripmine 2")
- return
- end
- local branchMode = 0
- local position = 0
- local positionLeft = 0
- local positionRight = 0
- local positionTorch = 0
- local positionLeftTorch = 0
- local positionRightTorch = 0
- local torchMode = 0
- local endChest = 0
- local itemSubtract = 15
- local chestMode = 0
- local waitMode = 0
- local IC = 0
- local check = 0
- function gravelStripmine()
- for i = 1, FrontTunnel do
- gravelDig()
- positionTorch = positionTorch+1
- position = position+1
- chestDrop()
- endChestDrop()
- TorchCheckPlace()
- end
- turtle.turnLeft()
- positionLeft = 0
- positionLeftTorch = 0
- for i = 1, tArgs[1] do
- gravelDig()
- positionLeftTorch = positionLeftTorch+1
- positionLeft = positionLeft+1
- chestDrop()
- endChestDrop()
- TorchCheckPlace()
- end
- moveBack()
- positionLeftTorch = 0
- positionLeft = 0
- turtle.turnRight()
- turtle.turnRight()
- positionRight = 0
- positionRightTorch = 0
- for i = 1, tArgs[1] do
- gravelDig()
- positionRightTorch = positionRightTorch+1
- positionRight = positionRight+1
- chestDrop()
- endChestDrop()
- TorchCheckPlace()
- end
- moveBack()
- positionRightTorch = 0
- positionRight = 0
- turtle.turnLeft()
- chestDrop()
- endChestDrop()
- end
- function speedStripmine()
- for i = 1, FrontTunnel do
- speedDig()
- positionTorch = positionTorch+1
- position = position + 1
- chestDrop()
- endChestDrop()
- TorchCheckPlace()
- end
- turtle.turnLeft()
- positionLeftTorch = 0
- positionLeft = 0
- for i = 1, tArgs[1] do
- speedDig()
- positionLeftTorch = positionLeftTorch+1
- positionLeft = positionLeft+1
- chestDrop()
- endChestDrop()
- TorchCheckPlace()
- end
- moveBack()
- positionLeftTorch = 0
- positionLeft = 0
- turtle.turnRight()
- turtle.turnRight()
- positionRightTorch = 0
- positionRight = 0
- for i = 1, tArgs[1] do
- speedDig()
- positionRightTorch = positionRightTorch+1
- positionRight = positionRight+1
- chestDrop()
- endChestDrop()
- TorchCheckPlace()
- end
- moveBack()
- positionRightTorch = 0
- positionRight = 0
- turtle.turnLeft()
- chestDrop()
- endChestDrop()
- end
- function endChestDrop()
- if endChest == 1 then
- itemSlot = 0
- for i = 1, 64 do
- itemSlot = itemSlot+1
- if turtle.getItemCount(13) == itemSlot then
- slot = 0
- for i = 1, 13 do
- slot = slot+1
- turtle.select(slot)
- if turtle.compareTo(16) == true then
- turtle.transferTo(16)
- end
- end
- turtle.select(14)
- while turtle.placeUp() == false do
- if turtle.detectUp() == true then
- turtle.digUp()
- sleep(0.6)
- end
- end
- if torchMode == 1 then
- for i = 1, positionLeft do
- moveBackChest()
- end
- if positionLeft > positionRight then
- turtle.turnRight()
- end
- for i = 1, positionRight do
- moveBackChest()
- end
- if positionRight > positionLeft then
- turtle.turnLeft()
- end
- for i = 1, position do
- moveBackChest()
- end
- turtle.turnLeft()
- turtle.select(15)
- turtle.suck()
- slot = 0
- for i = 1, 14 do
- slot = slot+1
- turtle.select(slot)
- if turtle.compareTo(15) == true then
- turtle.transferTo(15)
- end
- end
- slot = 0
- for i = 1, 14 do
- slot = slot+1
- turtle.select(slot)
- if turtle.compareTo(15) == true then
- turtle.drop()
- end
- end
- turtle.turnLeft()
- for i = 1, position do
- moveBackChest()
- end
- turtle.turnRight()
- turtle.turnRight()
- if positionRight > positionLeft then
- turtle.turnRight()
- for i = 1, positionRight do
- speedDig()
- end
- end
- if positionLeft > positionRight then
- turtle.turnLeft()
- for i = 1, positionLeft do
- speedDig()
- end
- end
- end
- slot = 0
- if turtle.detectUp() == true then
- for i = 1, 13 do
- slot = slot+1
- turtle.select(slot)
- while turtle.getItemCount(slot) > IC do
- turtle.dropUp()
- if turtle.getItemCount(slot) > IC then
- print("Master, the chest has no space left!")
- sleep(5)
- shell.run("clear")
- term.setCursorPos(1, 1)
- end
- end
- end
- end
- turtle.select(14)
- turtle.digUp()
- end
- end
- end
- end
- function chestDrop()
- IC1 = turtle.getItemCount(14)
- if chestMode == 1 then
- itemSlot = 0
- for i = 1, 64 do
- itemSlot = itemSlot+1
- if turtle.getItemCount(itemSubtract) == itemSlot then
- for i = 1, positionLeft do
- moveBackChest()
- end
- if positionLeft > positionRight then
- turtle.turnRight()
- end
- for i = 1, positionRight do
- moveBackChest()
- end
- if positionRight > positionLeft then
- turtle.turnLeft()
- end
- for i = 1, position do
- moveBackChest()
- end
- turtle.turnRight()
- turtle.turnRight()
- slot = 0
- if torchMode == 1 then
- turtle.turnRight()
- turtle.select(15)
- turtle.suck()
- for i = 1, itemSubtract do
- slot = slot+1
- turtle.select(slot)
- if turtle.compareTo(15) == true then
- turtle.transferTo(15)
- end
- end
- slot = 0
- for i = 1, itemSubtract do
- slot = slot+1
- turtle.select(slot)
- if turtle.compareTo(15) == true then
- turtle.drop()
- end
- end
- turtle.turnLeft()
- end
- slot = 0
- for i = 1, itemSubtract do
- slot = slot+1
- turtle.select(slot)
- if turtle.compareTo(16) == true then
- turtle.transferTo(16)
- end
- end
- slot = 0
- if turtle.detect() == true then
- if waitMode == 1 then
- for i = 1, itemSubtract do
- slot = slot+1
- turtle.select(slot)
- while turtle.getItemCount(slot) > IC do
- turtle.drop()
- if turtle.getItemCount(slot) > IC then
- print("Master, the chest has no space left!")
- sleep(5)
- shell.run("clear")
- term.setCursorPos(1, 1)
- end
- end
- end
- end
- slot = 0
- if waitMode == 0 then
- for i = 1, itemSubtract do
- slot = slot+1
- turtle.select(slot)
- turtle.drop()
- end
- end
- end
- for i = 1, position do
- moveBackChest()
- end
- turtle.turnRight()
- turtle.turnRight()
- if positionRight > positionLeft then
- turtle.turnRight()
- for i = 1, positionRight do
- speedDig()
- end
- end
- if positionLeft > positionRight then
- turtle.turnLeft()
- for i = 1, positionLeft do
- speedDig()
- end
- end
- end
- end
- end
- end
- function checkFuel()
- turtle.select(1)
- while turtle.getFuelLevel() == 0 do
- term.setCursorPos(1, 1)
- shell.run("clear")
- print("I am out of fuel my Master, refuel me and i will reboot!")
- sleep(2)
- slot = 0
- itemSlot = 0
- for i = 1, 64 do
- itemSlot = itemSlot+1
- for i = 1, 16 do
- slot = slot+1
- if turtle.getItemCount(slot) == itemSlot then
- turtle.select(slot)
- turtle.refuel(1)
- end
- end
- slot = 0
- end
- end
- term.setCursorPos(1, 1)
- shell.run("clear")
- print("I refueled succesfully my Master!")
- end
- function gravelDig()
- turtle.select(1)
- BlockBreakCount = 0
- while BlockBreakCount < 30 do
- while turtle.digUp() == true do
- sleep(0.6)
- end
- BlockBreakCount = BlockBreakCount+1
- end
- BlockBreakCount = 0
- while turtle.forward() == false do
- checkFuel()
- while turtle.attack() == true do
- sleep(1)
- end
- while BlockBreakCount < 30 do
- if turtle.dig() == true then
- sleep(0.4)
- end
- BlockBreakCount = BlockBreakCount+1
- end
- if torchMode == 1 then
- if turtle.detectDown() == true then
- turtle.select(15)
- if turtle.compareDown() == false then
- turtle.select(1)
- turtle.digDown()
- end
- end
- else
- turtle.digDown()
- end
- end
- end
- function speedDig()
- turtle.select(1)
- turtle.digUp()
- turtle.dig()
- if torchMode == 1 then
- if turtle.detectDown() == true then
- turtle.select(15)
- if turtle.compareDown() == false then
- turtle.select(1)
- turtle.digDown()
- end
- end
- else
- turtle.digDown()
- end
- BlockBreakCount = 0
- while turtle.forward() == false do
- checkFuel()
- turtle.attack()
- while BlockBreakCount < 30 do
- turtle.dig()
- BlockBreakCount = BlockBreakCount+1
- end
- end
- end
- function TorchCheckPlace()
- if torchMode == 1 then
- Input6 = Input6+1
- if turtle.getItemCount(15) == 0 then
- for i = 1, positionLeft do
- moveBackChest()
- end
- if positionLeft > positionRight then
- turtle.turnRight()
- end
- for i = 1, positionRight do
- moveBackChest()
- end
- if positionRight > positionLeft then
- turtle.turnLeft()
- end
- for i = 1, position do
- moveBackChest()
- end
- turtle.turnLeft()
- while turtle.getItemCount(15) == 0 do
- turtle.select(15)
- turtle.suck()
- slot = 0
- for i = 1, itemSubtract do
- slot = slot+1
- turtle.select(slot)
- sleep(0.2)
- if turtle.compareTo(15) == true then
- turtle.transferTo(15)
- end
- end
- slot = 0
- for i = 1, itemSubtract do
- slot = slot+1
- turtle.select(slot)
- sleep(0.2)
- if turtle.compareTo(15) == true then
- turtle.drop()
- end
- end
- end
- turtle.turnLeft()
- for i = 1, position do
- moveBackChest()
- end
- turtle.turnRight()
- turtle.turnRight()
- if positionRight > positionLeft then
- turtle.turnRight()
- for i = 1, positionRight do
- speedDig()
- end
- end
- if positionLeft > positionRight then
- turtle.turnLeft()
- for i = 1, positionLeft do
- speedDig()
- end
- end
- end
- if positionTorch == Input6 then
- turtle.digDown()
- turtle.select(15)
- turtle.placeDown()
- turtle.select(1)
- positionTorch = positionTorch-Input6
- end
- Input6 = Input6-1
- Input6 = Input6+1
- if positionLeftTorch == Input6 then
- turtle.digDown()
- turtle.select(15)
- turtle.placeDown()
- turtle.select(1)
- positionLeftTorch = positionLeftTorch-Input6
- end
- Input6 = Input6-1
- Input6 = Input6+1
- if positionRightTorch == Input6 then
- turtle.digDown()
- turtle.select(15)
- turtle.placeDown()
- turtle.select(1)
- positionRightTorch = positionRightTorch-Input6
- end
- Input6 = Input6-1
- end
- end
- function moveBack()
- for i = 1, tArgs[1] do
- if turtle.back() == false then
- checkFuel()
- turtle.turnRight()
- turtle.turnRight()
- while turtle.attack() == true do
- sleep(1)
- end
- while turtle.dig() == true do
- sleep(0.6)
- end
- if turtle.forward() == false then
- speedDig()
- end
- turtle.turnRight()
- turtle.turnRight()
- end
- end
- end
- function moveBackChest()
- if turtle.back() == false then
- checkFuel()
- turtle.turnRight()
- turtle.turnRight()
- while turtle.attack() == true do
- sleep(1)
- end
- while turtle.dig() == true do
- sleep(0.6)
- end
- if turtle.forward() == false then
- speedDig()
- end
- turtle.turnRight()
- turtle.turnRight()
- end
- end
- print("Do you wish to use Default or Custom mode?")
- print("write <default> or Press ENTER")
- defaultCheck = read()
- if defaultCheck == "default" then
- tArgs[1] = tArgs[1]+1
- itemSubtract = itemSubtract-1
- Input2 = 20
- Input6 = 6
- FrontTunnel = 2
- branchMode = 2
- chestMode = 1
- waitMode = 1
- torchMode = 1
- FrontTunnel = FrontTunnel+1
- Input8 = "yes"
- shell.run("clear")
- term.setCursorPos(1, 1)
- print("Put coal in slot #16, torches #15")
- print("Also put a chest behind the turtle, if you want it to drop the loot it finds")
- print("Put a chest to the left of the turtle, to resupply it with torches")
- print("Press ENTER to continue!")
- infoSkip = read()
- if branchMode == 2 then
- for i = 1, Input2 do
- speedStripmine()
- end
- if Input8 == "yes" then
- for i = 1, positionLeft do
- moveBackChest()
- end
- if positionLeft > positionRight then
- turtle.turnRight()
- end
- for i = 1, positionRight do
- moveBackChest()
- end
- if positionRight > positionLeft then
- turtle.turnLeft()
- end
- for i = 1, position do
- moveBackChest()
- end
- end
- print("I am done my Master!")
- end
- return
- end
- print("Write <speed> or <gravel> -Andersfc, the maker of this program")
- print("He suggests using the speed-mode")
- term.write("Speed-Mode or Gravel-Mode?>")
- Input1 = read()
- if Input1 == "speed" or Input1 == "gravel" then
- check = 0
- else
- shell.run("clear")
- print("You misstyped speed or gravel")
- return
- end
- shell.run("clear")
- term.setCursorPos(1, 1)
- print("Write the amount of cycles to run")
- term.write("How many cycles?>")
- Input2 = read()
- shell.run("clear")
- term.setCursorPos(1, 1)
- print("Write <chest>, <enderchest> or <nochest>")
- term.write("Master do you want chests?>")
- Input3 = read()
- if Input3 == "chest" or Input3 == "enderchest" or Input3 == "nochest" then
- check = 0
- else
- shell.run("clear")
- print("You misstyped chest, enderchest or nochest")
- return
- end
- shell.run("clear")
- term.setCursorPos(1, 1)
- if Input3 == "chest" then
- print("write <wait> or <nowait>, this mode is useful if your chest is full, then the turtle will")
- print("wait till the chest has room")
- term.write("Master should i wait?>")
- Input4 = read()
- end
- if Input4 == "wait" or Input4 == "nowait" then
- check = 0
- else
- shell.run("clear")
- print("You misstyped wait or nowait")
- return
- end
- if Input3 == "enderchest" then
- endChest = 1
- end
- shell.run("clear")
- term.setCursorPos(1, 1)
- print("write <torch> or <notorch> this mode is just used if you want torch-placing")
- term.write("Master do you want torches?>")
- Input5 = read()
- if Input5 == "torch" or Input5 == "notorch" then
- check = 0
- else
- shell.run("clear")
- print("You misstyped torch or notorch")
- return
- end
- if Input5 == "torch" then
- itemSubtract = itemSubtract-1
- end
- if Input5 == "torch" then
- shell.run("clear")
- term.setCursorPos(1, 1)
- print("Write the amount of space, between the torches")
- print("-Andersfc, the maker of this program, suggests to use about 6 blocks space between")
- print("If you dont want mob-spawns")
- term.write("How much space between the torches?>")
- Input6 = read()
- end
- shell.run("clear")
- term.setCursorPos(1, 1)
- print("Write the amount of space between the branch-tunnels")
- print("-Andersfc, the maker of this program, suggests using 2-4 blocks space")
- term.write("How much space between?>")
- FrontTunnel = read()
- shell.run("clear")
- term.setCursorPos(1, 1)
- print("Master, should i go back to my starting-position, when i'm done mining?")
- print("Write <yes> or <no>")
- term.write("Should i go back?>")
- Input8 = read()
- if Input8 == "yes" or Input1 == "no" then
- check = 0
- else
- shell.run("clear")
- print("You misstyped yes or no")
- return
- end
- shell.run("clear")
- term.setCursorPos(1, 1)
- print("Put coal in slot #16, torches #15, ender chest for dropping items #14")
- print("Also put a chest behind the turtle, if you want it to drop the loot it finds")
- print("Put a chest to the left of the turtle, to resupply it with torches")
- print("Press ENTER to continue!")
- infoSkip = read()
- tArgs[1] = tArgs[1]+1
- if Input1 == "speed" then
- branchMode = 2
- end
- if Input1 == "gravel" then
- branchMode = 1
- end
- if Input3 == "chest" then
- chestMode = 1
- end
- if Input4 == "wait" then
- waitMode = 1
- end
- if Input5 == "torch" then
- torchMode = 1
- end
- FrontTunnel = FrontTunnel+1
- if branchMode == 1 then
- for i = 1, Input2 do
- gravelStripmine()
- end
- if Input8 == "yes" then
- for i = 1, positionLeft do
- moveBackChest()
- end
- if positionLeft > positionRight then
- turtle.turnRight()
- end
- for i = 1, positionRight do
- moveBackChest()
- end
- if positionRight > positionLeft then
- turtle.turnLeft()
- end
- for i = 1, position do
- moveBackChest()
- end
- end
- print("I am done my Master!")
- end
- if branchMode == 2 then
- for i = 1, Input2 do
- speedStripmine()
- end
- if Input8 == "yes" then
- for i = 1, positionLeft do
- moveBackChest()
- end
- if positionLeft > positionRight then
- turtle.turnRight()
- end
- for i = 1, positionRight do
- moveBackChest()
- end
- if positionRight > positionLeft then
- turtle.turnLeft()
- end
- for i = 1, position do
- moveBackChest()
- end
- end
- print("I am done my Master!")
- end
Add Comment
Please, Sign In to add comment