Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local fcount = 0
- local mcount = 0
- local lcount = 0
- local SRcount = 0
- local SLcount = 0
- local SFcount = 0
- local fuellevel = turtle.getFuelLevel()
- local procends = 0
- local Dcount = 0
- local SDcount = 0
- function getcoal() ---Refueling funciton--
- turtle.select(1)
- fuellevel = turtle.getFuelLevel()
- Local I2count = turtle.getItemCount()
- if fuellevel < 1000 then
- I3count = 64 - I2count
- turtle.suckUp( I3count )
- turtle.refuel( 1,5 )
- end
- function ymine1()
- turtle.turnLeft()
- turtle.dig()
- turtle.digUp()
- turtle.digDown()
- turtle.forward()
- turtle.dig
- turtle.digUp()
- turtle.digDown()
- turtle.forward()
- end
- function Ymine()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- ymine1()
- ymine1()
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- end
- function Downmine()
- Dcount = Dcount + 1
- turtle.select(16)
- local Icount = turtle.getItemCount()
- if Icount == 0 then
- turtle.select(16)
- Icount = turtle.getItemCount()
- turtle.select(1)
- turtle.Down()
- tutle.digDown()
- turtle.Down()
- tutle.digDown()
- Ymine()
- end
- end
- function Dig()
- if turtle.detect() then
- repeat
- turtle.dig()
- local gravel = turtle.detect()
- until gravel == false
- end
- turtle.forward()
- if turtle.detectUp() then
- turtle.digUp()
- if turtle.detectDown() then
- turtle.digDown()
- end
- end
- end
- function Inventory() ---Tier 1 Mining Function---
- turtle.select(16)
- local Icount = turtle.getItemCount()
- if Icount == 0 then
- turtle.select(16)
- Icount = turtle.getItemCount()
- turtle.select(1)
- fcount = fcount + 1
- turtle.turnLeft()
- Dig()
- turtle.back()
- turtle.turnRight()
- turtle.turnRight()
- Dig()
- turtle.back()
- turtle.turnLeft()
- turtle.digUp()
- turtle.digDown()
- turtle.dig()
- turtle.forward()
- end
- end
- function home()
- repeat
- turtle.back()
- fcount = fcount - 1
- until fcount == 0
- end
- function Dropoff()
- for I= 2, 16, 1 do
- turtle.select(I)
- turtle.dropDown()
- end
- end
- function fuel()
- local fuellevel = turtle.getFuelLevel()
- if fuellevel < fcount + 5 then
- turtle.select(1)
- turtle.refuel( 1, 10 )
- end
- if fuellevel < fcount + 10 then
- local procends = 1
- repeat
- turtle.back()
- fcount = fcount - 1
- until fcount == 0
- Dropoff()
- end
- end
- function Dig()
- if turtle.detect() then
- repeat
- turtle.dig()
- local gravel = turtle.detect()
- until gravel == false
- end
- turtle.forward()
- if turtle.detectUp() then
- turtle.digUp()
- if turtle.detectDown() then
- turtle.digDown()
- end
- end
- end
- function miningJobF()
- while Icount == 0 and procends == 0 do
- Inventory()
- SFcount = SFcount +1
- fuel()
- end
- home()
- end
- function miningJobR()
- while Icount == 0 and procends == 0 do
- Inventory()
- fuel()
- end
- home()
- SRcount = SRcount + 3
- end
- function miningJobL()
- while Icount == 0 and procends == 0 do
- Inventory()
- fuel()
- end
- home()
- SLcount = SLcount +3
- end
- function movement()
- repeat
- if turtle.detect() == false then
- turtle.forward()
- fcount = fcount + 1
- end
- until turtle.detect() == true
- end
- function NewtunnelFOW()
- TSF = SFcount
- repeat
- turtle.dig()
- turtle.forward()
- TSF = TSF - 1
- until TSF == SFcount or TSF < 0 or turtle.detect() == true
- end
- function NewtunnelLEF()
- TSL = SLcount
- repeat
- turtle.forward()
- lcount = lcount + 1
- TSL = TSL - 1
- until TSL == SLcount or TSL < 0 or turtle.detect() == true
- turtle.turnLeft()
- movement()
- end
- function NewtunnelRIG()
- TSR = SRcount
- repeat
- turtle.forward()
- lcount = lcount + 1
- TSR = TSR - 1
- until TSR == SRcount or TSR < 0 or turtle.detect() == true
- turtle.turnRight()
- movement()
- end
- function Straight()
- getcoal()
- procends = 0
- Icount = 0
- NewtunnelFOW()
- miningJobF()
- end
- function Lefttime()
- getcoal()
- procends = 0
- Icount = 0
- NewtunnelLEF()
- miningJobL()
- end
- function Righttime()
- getcoal()
- procends = 0
- Icount = 0
- NewtunnelRIG()
- miningJobR()
- end
- function logicish()
- if SFcount == 0 then
- Straight()
- end
- if SRcount == SFcount then
- if SFcount == SLcount then
- local function RN()
- local rand = math.random(1,3)
- return rand
- end
- local num = RN()
- end
- end
- if num == 1 then
- Stright()
- end
- if num == 2 then
- Righttime()
- end
- if num == 3 then
- Lefttime()
- end
- if SFcount < SRcount and SFcount < SLcount then
- Stright()
- end
- if SRcount < SFcount and SRcount < SLcount then
- Righttime()
- end
- if SLcount < SFcount and SLcount < SRcount then
- Lefttime()
- end
- if SLcount == SRcount and SLcount < SFcount then
- local function RN()
- local rand = math.random(1,2)
- return rand
- end
- local num = RN()
- end
- if num == 1 then
- Lefttime()
- end
- if num == 2 then
- Righttime()
- end
- if SFcount == SRcount and SRcount < SFcount then
- local function RN()
- local rand = math.random(1,2)
- return rand
- end
- local num = RN()
- end
- if num == 1 then
- Stright()
- end
- if num == 2 then
- Righttime()
- end
- if SFcount == SLcount and SLcount < SRcount then
- local function RN()
- local rand = math.random(1,2)
- return rand
- end
- local num = RN()
- end
- if num == 1 then
- Lefttime()
- end
- if num == 2 then
- Stright()
- end
- end
- local X = 1
- while X == 1 do
- logicish()
- end
Add Comment
Please, Sign In to add comment