Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --startup
- term.write("Insert Length: ")
- Length = tonumber(read())
- print(" ")
- term.write("Insert - times 3 - Width: ")
- Width = tonumber(read())
- print(" ")
- local Length = Length
- local Width = Width
- local goRight = 0
- local firstStartUp = false
- local times_forward = 0
- local time_left = 0
- local torch_forward = 0
- local torchCounter = 0
- --slots
- local torchSlot = 1
- local chestSlot = 2
- function firstStartUp()
- Width = Width - 1
- --check if torches and a chest is set
- if turtle.getItemCount(torchSlot) < 1 then
- print("put torches in slot 1!")
- repeat
- sleep (1.1)
- until turtle.getItemCount(torchSlot) > 1
- end
- if turtle.getItemCount(chestSlot) < 1 then
- print("put chestes in slot 2!")
- repeat
- sleep (1.1)
- until turtle.getItemCount(chestSlot) >= 1
- end
- turtle.digDown()
- turtle.select(chestSlot)
- turtle.placeDown()
- -- mine first thing
- repeat
- turtle.digUp()
- until turtle.up() == true
- turtle.down()
- -- ga naar links, dig, naar voren, dig up&down
- turtle.turnLeft()
- repeat
- turtle.dig()
- until not turtle.detect() == true
- turtle.forward()
- repeat
- turtle.digUp()
- until turtle.up() == true
- turtle.down()
- turtle.digDown()
- -- ga naar rechts, vooren, dig up dig up&down
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- repeat
- turtle.dig()
- until not turtle.detect() == true
- turtle.forward()
- repeat
- turtle.digUp()
- until turtle.up() == true
- turtle.down()
- turtle.digDown()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- firstStartUp = true
- end
- function mineForward()
- --ga een vooruit
- repeat
- turtle.dig()
- until not turtle.detect() == true
- turtle.forward()
- repeat
- turtle.digUp()
- until turtle.up() == true
- turtle.down()
- turtle.digDown()
- -- ga naar links, dig, naar voren, dig up
- turtle.turnLeft()
- repeat
- turtle.dig()
- until not turtle.detect() == true
- turtle.forward()
- repeat
- turtle.digUp()
- until turtle.up() == true
- turtle.down()
- turtle.digDown()
- -- ga naar rechts, vooren, dig up dig down
- turtle.turnRight()
- turtle.turnRight()
- turtle.forward()
- repeat
- turtle.dig()
- until not turtle.detect() == true
- turtle.forward()
- repeat
- turtle.digUp()
- until turtle.up() == true
- turtle.down()
- turtle.digDown()
- -- ga weer terug naar midden positie
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- times_forward = times_forward + 1
- torch_forward = torch_forward + 1
- doIneedAtorch()
- doIneedToEmpty()
- end
- function doIneedAtorch()
- --check if torches not empty
- turtle.select(torchSlot)
- if turtle.getItemCount(torchSlot) < 1 then
- turtle.turnLeft()
- turtle.turnLeft()
- for i=1,times_forward do
- turtle.forward()
- end
- print("put torches in slot 1!")
- repeat
- sleep (1.1)
- until turtle.getItemCount(torchSlot) > 1
- turtle.turnLeft()
- turtle.turnLeft()
- for i=1,times_forward do
- turtle.forward()
- end
- end
- --plaats een torch
- if Length > 8 then
- if torch_forward == 8 then
- turtle.select(1)
- turtle.placeDown()
- torchCounter = torchCounter + 1
- torch_forward = 0
- end
- end
- if Length < 8 then
- if torch_forward == Length then
- turtle.select(1)
- turtle.placeDown()
- torchCounter = torchCounter + 1
- torch_forward = 0
- end
- end
- end
- function doIneedToEmpty()
- turtle.getItemCount(16)
- if turtle.getItemCount(16) > 0 then
- print("gotte go clean my inventory!")
- turtle.turnLeft()
- turtle.turnLeft()
- for i=1,times_forward do
- turtle.forward()
- end
- if time_left == 0 then
- for q=2,16 do
- turtle.select(q)
- turtle.dropDown()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- for i=1,times_forward do
- turtle.forward()
- end
- end
- if time_left >= 1 then
- turtle.turnLeft()
- x = 0
- repeat
- turtle.forward()
- turtle.forward()
- turtle.forward()
- x = x + 1
- until x == time_left
- for q=2,16 do
- turtle.select(q)
- turtle.dropDown()
- end
- turtle.turnLeft()
- turtle.turnLeft()
- x = 0
- repeat
- turtle.forward()
- turtle.forward()
- turtle.forward()
- x = x + 1
- until x == time_left
- turtle.turnRight()
- for i=1,times_forward do
- turtle.forward()
- end
- end
- end
- turtle.select(2)
- end
- function goLeftbyOne()
- turtle.turnRight()
- turtle.forward()
- repeat
- turtle.dig()
- until not turtle.detect() == true
- turtle.forward()
- repeat
- turtle.digUp()
- until turtle.up() == true
- turtle.down()
- turtle.digDown()
- repeat
- turtle.dig()
- until not turtle.detect() == true
- turtle.forward()
- repeat
- turtle.digUp()
- until turtle.up() == true
- turtle.down()
- turtle.digDown()
- repeat
- turtle.dig()
- until not turtle.detect() == true
- turtle.forward()
- repeat
- turtle.digUp()
- until turtle.up() == true
- turtle.down()
- turtle.digDown()
- turtle.back()
- turtle.turnRight()
- time_left = time_left + 1
- end
- function everythingDone()
- print("gotte go clean my inventory!")
- turtle.turnLeft()
- turtle.turnLeft()
- for i=1,times_forward do
- turtle.forward()
- end
- if time_left == 0 then
- for q=2,16 do
- turtle.select(q)
- turtle.dropDown()
- end
- print("done with emptieing")
- end
- if time_left >= 1 then
- turtle.turnLeft()
- x = 0
- repeat
- turtle.forward()
- turtle.forward()
- turtle.forward()
- x = x + 1
- until x == time_left
- for q=2,16 do
- turtle.select(q)
- turtle.dropDown()
- end
- turtle.turnRight()
- print("done with emptieing")
- end
- end
- function goBack()
- turtle.turnLeft()
- turtle.turnLeft()
- for i=1,times_forward do
- turtle.forward()
- end
- end
- print("Lets GO!")
- firstStartUp()
- repeat
- repeat
- mineForward()
- until times_forward == Length
- turtle.select(1)
- turtle.placeDown()
- torchCounter = torchCounter + 1
- goBack()
- if time_left ~= Width then
- goLeftbyOne()
- end
- times_forward = 0
- until time_left == Width
- mineForward()
- everythingDone()
- print ("DONE")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement