Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --start
- term.write("Insert Length: ")
- Length = tonumber(read())
- print(" ")
- term.write("Insert Width: ")
- Width = tonumber(read())
- print(" ")
- term.write("Insert Height Devided by 3: ")
- Height = tonumber(read())
- print(" ")
- local fuelslot = 1
- local torchslot = 2
- local counter = 0
- local Height = Height
- local Length = Length
- local Width = Width
- local xLength = 0
- local xHeight = 0
- local xWidth = 0
- local down = 0
- local i = 3
- local DrieHeight = Height * 3
- local x = 0
- local y = 0
- local z = 0
- local xx = 0
- local yy = 0
- local zz = 0
- print("*** Miner Bot By Fish ***")
- print(" Fuelslot = 1")
- print(" Torchslot = 2")
- print("*************************")
- print("Length =" .. Length)
- print("Height =" .. Height * 3)
- print("Width =" .. Width)
- print("*************************")
- print("fuel needed =" .. Length * Width * DrieHeight)
- print("*************************")
- sleep(1)
- --fuel check
- function fuelslotcheck()
- if turtle.getItemCount(fuelslot) < 1 then
- turtle.select(fuelslot)
- turtle.turnLeft()
- turtle.turnLeft()
- print("put fuel in the chest!")
- repeat
- turtle.suck()
- until turtle.getItemCount(fuelslot) > 1
- turtle.turnRight()
- turtle.turnRight()
- end
- end
- function refuel()
- if turtle.getFuelLevel() < 800 then
- turtle.select(fuelslot)
- repeat
- turtle.refuel(fuelslot)
- sleep(0.5)
- until turtle.getFuelLevel() > 1600
- turtle.select(3)
- end
- end
- -- torches
- function torchesslotcheck()
- if turtle.getItemCount(torchslot) < 1 then
- turtle.select(torchslot)
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.up()
- print("put torches in the chest!")
- repeat
- turtle.suck()
- until turtle.getItemCount(torchslot) > 1
- turtle.down()
- turtle.turnRight()
- turtle.turnRight()
- end
- end
- function digBlock()
- repeat
- turtle.dig()
- until not turtle.detect() == true
- repeat
- turtle.digUp()
- until not turtle.detect() == true
- repeat
- turtle.digDown()
- until not turtle.detect() == true
- end
- function check()
- turtle.select(1)
- turtle.getItemCount(16)
- if turtle.getItemCount(16) > 0 then
- print("gotte go clean my inventory!")
- turtle.turnLeft()
- turtle.turnLeft()
- xx = x
- zz = z
- yy = y
- --go home
- if x ~= 0 then
- repeat
- turtle.forward()
- x = x - 1
- sleep(0.5)
- print("x:" .. x)
- print("y:" .. y)
- print("z:" .. z)
- print("xx:" .. xx)
- print("yy:" .. yy)
- print("zz:" .. zz)
- until x == 0
- turtle.turnLeft()
- end
- if y ~= 0 then
- repeat
- turtle.forward()
- y = y - 1
- sleep(0.5)
- print("x:" .. x)
- print("y:" .. y)
- print("z:" .. z)
- print("xx:" .. xx)
- print("yy:" .. yy)
- print("zz:" .. zz)
- until y == 0
- end
- if z ~= 0 then
- repeat
- turtle.up()
- z = z - 1
- sleep(0.5)
- print("x:" .. x)
- print("y:" .. y)
- print("z:" .. z)
- print("xx:" .. xx)
- print("yy:" .. yy)
- print("zz:" .. zz)
- until z == 0
- end
- --Throw everything away
- repeat
- turtle.select(i)
- turtle.drop()
- i = i + 1
- until i == 17
- turtle.turnRight()
- turtle.turnRight()
- Heighthowmany = 0
- howmany = 0
- widthhowmany = 0
- i = 3
- turtle.select(i)
- --Go Back
- if z ~= zz then
- repeat
- turtle.down()
- z = z + 1
- sleep(0.5)
- print("x:" .. x)
- print("y:" .. y)
- print("z:" .. z)
- print("xx:" .. xx)
- print("yy:" .. yy)
- print("zz:" .. zz)
- until z == zz
- end
- if y ~= yy then
- repeat
- turtle.forward()
- y = y + 1
- sleep(0.5)
- print("x:" .. x)
- print("y:" .. y)
- print("z:" .. z)
- print("xx:" .. xx)
- print("yy:" .. yy)
- print("zz:" .. zz)
- until y == yy
- end
- turtle.turnRight()
- if x ~= xx then
- repeat
- turtle.forward()
- x = x + 1
- sleep(0.5)
- print("x:" .. x)
- print("y:" .. y)
- print("z:" .. z)
- print("xx:" .. xx)
- print("yy:" .. yy)
- print("zz:" .. zz)
- until x == xx
- end
- else
- print("Nothing to clean")
- end
- end
- function status()
- print("********************")
- print("fuellevel:" .. turtle.getFuelLevel())
- print("xLength:" .. xLength)
- print("down:" .. down)
- print("Height:" .. Height)
- print("Length:" .. Length)
- print("Width" .. Width)
- print("********************")
- end
- function forward()
- xLength = Length
- repeat
- status()
- digBlock()
- turtle.forward()
- turtle.digUp()
- turtle.digDown()
- xLength = xLength - 1
- x = x + 1
- check()
- until xLength == 0
- xLength = Length
- turtle.turnRight()
- turtle.turnRight()
- repeat
- status()
- turtle.forward()
- xLength = xLength - 1
- x = x - 1
- until xLength == 0
- Width = Width - 1
- if Width > 0 then
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- xWidth = xWidth + 1
- y = y + 1
- else
- turtle.turnLeft()
- repeat
- status()
- turtle.forward()
- xWidth = xWidth -1
- until xWidth == 0
- y = 0
- end
- end
- --go
- print("Starting..")
- fuelslotcheck()
- refuel()
- torchesslotcheck()
- print("First Steps")
- turtle.digDown()
- turtle.down()
- z = z + 1
- down = down + 1
- Length = Length - 1
- repeat
- repeat
- status()
- forward()
- refuel()
- until Width == 0
- turtle.turnLeft()
- turtle.digDown()
- turtle.down()
- down = down + 1
- z = z + 1
- turtle.digDown()
- turtle.down()
- down = down + 1
- z = z + 1
- turtle.digDown()
- turtle.down()
- down = down + 1
- z = z + 1
- Width = Length
- Width = Width + 1
- Height = Height - 1
- until Height == 0
- print("Done going down. Let's go up!")
- if Height == 0 then
- repeat
- status()
- turtle.up()
- down = down - 1
- until down == 0
- z = 0d
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement