Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Quarry a function by Maximumrider999
- file = io.open("variables.txt", "rb")
- local lines = {}
- for line in io.lines("variables.txt") do
- local words = {}
- for word in line:gmatch("%w+") do
- table.insert(words, word)
- end
- table.insert(lines, words)
- end
- local loops = 15
- local j = tonumber(lines[2][1])
- local position1 = tonumber(lines[3][1])
- local position2 = tonumber(lines[4][1])
- local position3 = tonumber(lines[5][1])
- local currentK = tonumber(lines[6][1])
- local currentLoop = tonumber(lines[7][1])
- local heading = tonumber(lines[8][1])
- local torch = 2
- local fuel = 1
- local chest = 3
- --Vars
- local tArgs = {...}
- if tArgs[1] ~= nul then
- print("test")
- local loops = tonumber(tArgs[1])
- local torch = 2
- local fuel = 1
- local chest = 3
- local j = 0
- local position1 = 1
- local position2 = 1
- local position3 = 1
- local currentk = 0
- local currentLoop = 0
- local heading = 0
- end
- --Functions
- function Edit(changeNumber, change)
- file = io.open("variables.txt", "r")
- local fileContent = {}
- for line in file:lines() do
- table.insert (fileContent, line)
- end
- io.close(file)
- fileContent[changeNumber] = change
- file = io.open("variables.txt", 'w')
- for index, value in ipairs(fileContent) do
- file:write(value..'\n')
- end
- io.close(file)
- end
- --Edit(1, loops)
- function tfuel(amount)
- if turtle.getFuelLevel() < amount then do
- turtle.select(fuel)
- turtle.refuel()
- end
- end
- end
- function digForward(amount, p, i2)
- if amount < 1 then
- amount = 1
- end
- for i = 1, amount do
- while turtle.detect() == true do
- turtle.dig()
- end
- turtle.forward()
- if heading == 1 or heading == 2 then
- Edit(p,i2)
- end
- turtle.select(16)
- if turtle.getItemCount() > 0 then
- if heading == 1 then
- turtle.turnLeft()
- heading = 3
- Edit(8, heading)
- turtle.select(chest)
- turtle.place()
- for i = 4, 16 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.turnRight()
- heading = 1
- Edit(8, heading)
- end
- if heading == 2 then
- turtle.turnRight()
- heading = 3
- Edit(8, heading)
- turtle.select(chest)
- turtle.place()
- for i = 4, 16 do
- turtle.select(i)
- turtle.drop()
- end
- turtle.turnLeft()
- heading = 2
- Edit(8, heading)
- end
- end
- turtle.select(1)
- turtle.digUp()
- turtle.digDown()
- end
- end
- function placeTorch()
- turtle.select(torch)
- turtle.placeDown()
- end
- function turnAround()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- --Main
- for i = currentLoop, loops do
- Edit(7, i)
- if heading == 0 and position1 == 1 then
- if j == 3 then
- j = 0
- else
- j = j + 1
- Edit(2, j)
- end
- end
- for k = currentK,2 do
- Edit(6, k)
- tfuel(1000)
- if position1 == 1 then
- --[[turtle.select(16)
- if turtle.getItemCount() > 0 then
- if heading == 0 then
- turnAround()
- end
- turtle.select(chest)
- turtle.place()
- for i = 4, 16 do
- turtle.select(i)
- turtle.drop()
- end
- turnAround()
- heading = 0
- Edit(8, heading)
- end]]
- turtle.select(1)
- digForward(1)
- turtle.turnLeft()
- heading = 1
- Edit(8, heading)
- end
- if heading == 3 then
- if position2 == 7 then
- turtle.turnLeft()
- heading = 2
- Edit(8, heading)
- else
- turtle.turnRight()
- heading = 1
- Edit(8, heading)
- end
- end
- if heading == 1 then
- print("test")
- for i = position1,5 do
- Edit(3, i)
- digForward(1,3,i+1)
- --Edit(3, i+1)
- end
- print("test2")
- Edit(3,6)
- if j == 3 and k == 0 then
- placeTorch()
- end
- for i = position2,6 do
- Edit(4, i)
- digForward(1,4,i+1)
- --Edit(4, i+1)
- end
- print("test3")
- Edit(4,7)
- if j == 3 and k == 0 then
- placeTorch()
- end
- turtle.turnRight()
- heading = 0
- Edit(8, heading)
- end
- if heading == 0 then
- digForward(1)
- turtle.turnRight()
- heading = 2
- Edit(8, heading)
- end
- if heading == 2 then
- for i = position3,11 do
- Edit(5, i)
- digForward(1,5,i+1)
- --Edit(5, i+1)
- end
- Edit(5,12)
- turtle.turnLeft()
- heading = 0
- Edit(8, heading)
- end
- if j == 3 and k == 0 then
- placeTorch()
- end
- turtle.digUp()
- turtle.digDown()
- if k ~= 2 then
- turtle.back()
- turtle.back()
- turtle.digUp()
- turtle.up()
- turtle.digUp()
- turtle.up()
- turtle.digUp()
- turtle.up()
- end
- position1 = 1
- position2 = 1
- position3 = 1
- Edit(3,1)
- Edit(4,1)
- Edit(5,1)
- end
- for i = 1,6 do
- turtle.down()
- end
- Edit(6,0)
- currentK = 0
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement