Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- k = 1
- allitems = 0
- turtle.select(1)
- function tclear(x,y)
- if x == nil then
- x = 1
- end
- if y == nil then
- y = 1
- end
- term.clear()
- term.setCursorPos(x,y)
- end
- function load(name)
- local file = fs.open(name,"r")
- local data = file.readAll()
- file.close()
- return textutils.unserialize(data)
- end
- function save(table,name)
- local file = fs.open(name,"w")
- file.write(textutils.serialize(table))
- file.close()
- end
- function useFuel(slotnum)
- turtle.select(slotnum)
- turtle.refuel(1)
- end
- function items()
- for i = 1, 16 do
- actitem = turtle.getItemCount(i)
- allitems = allitems + actitem
- end
- return allitems
- end
- function refuel()
- for i = 1,16 do
- if turtle.getItemCount(i) > 0 then
- for j = 1,turtle.getItemCount(i) do
- useFuel(i)
- end
- end
- end
- end
- function setforward()
- if turtle.getItemCount(k) == 0 then
- while turtle.getItemCount(k) == 0 do
- k = k + 1
- if k > 16 and items() > 0 then
- k = 1
- end
- turtle.select(k)
- end
- end
- if turtle.placeDown() == false then
- turtle.digDown()
- turtle.placeDown()
- end
- if turtle.forward() == false then
- while turtle.forward() == false do
- turtle.dig()
- end
- end
- end
- function mineforward()
- if turtle.forward() == false then
- while turtle.forward() == false do
- turtle.dig()
- end
- end
- end
- function turnright()
- turtle.turnRight()
- turtle.dig()
- mineforward()
- turtle.turnRight()
- end
- function turnleft()
- turtle.turnLeft()
- turtle.dig()
- mineforward()
- turtle.turnLeft()
- end
- function mineCube(high, width, length)
- high = tonumber(high)
- width = tonumber(width)
- length =tonumber(length)
- l = 0
- for i = 1, high do
- for j = 1, width do
- for k = 1, length do
- turtle.dig()
- mineforward()
- end
- if j < width then
- l = l + 1
- if l < 2 then
- turnright()
- else
- turnleft()
- l = 0
- end
- end
- end
- turtle.digUp()
- turtle.up()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- end
- function setCube(high, width, length)
- tonumber(high)
- tonumber(width)
- tonumber(length)
- l = 0
- turtle.up()
- for i = 1, high do
- for j = 1, width do
- for k = 1, length do
- setforward()
- end
- if j < width then
- l = l + 1
- if l < 2 then
- turtle.turnRight()
- mineforward()
- turtle.turnRight()
- mineforward()
- else
- turtle.turnLeft()
- mineforward()
- turtle.turnLeft()
- mineforward()
- l = 0
- end
- end
- end
- turtle.up()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.forward()
- end
- end
- turtle.select(1)
Advertisement
Add Comment
Please, Sign In to add comment