Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- slots 1-8 Sand
- -- slots 9-12 cobblestone
- -- slot 13 empty
- -- slot 14 cobblestone
- -- slot 15 sand
- -- slot 16 coal
- local w,h = term.getSize()
- local selection = 0
- local internalselection = 0
- local range = 0
- local currentrange = 0
- local ypos = 1
- local fuel
- local fuelava
- local counter = 0
- local turnleftvar = 1
- local turnrightvar = 0
- local itemcount = 0
- local itemcompare
- --Some draw functions to get us started
- local function printCentered(str, ypos)
- term.setCursorPos(w/2 - #str/2, ypos)
- term.write(str)
- end
- local function printFarLeft(str, ypos)
- term.setCursorPos(1, ypos)
- term.write(str)
- end
- local function printLeft(str, ypos)
- term.setCursorPos(5, ypos)
- term.write(str)
- end
- local function printLeft2(str, ypos)
- term.setCursorPos(10, ypos)
- term.write(str)
- end
- local function printRight(str, ypos)
- term.setCursorPos(w - 15, ypos)
- term.write(str)
- end
- local function printRight2(str, ypos)
- term.setCursorPos(w - 25, ypos)
- term.write(str)
- end
- local function printFarRight(str, ypos)
- term.setCursorPos(w - #str, ypos)
- term.write(str)
- end
- function drawHeader()
- printCentered("Turtle Control", 1)
- printCentered(string.rep("-", w+1), 2)
- -- print fuel level
- fuel = turtle.getFuelLevel()
- printFarLeft("Fuel " ,3)
- print(fuel)
- -- print avilable fuel
- fuelava = turtle.getItemCount(16)
- printFarLeft("Fuel Available " ,5)
- print(fuelava)
- -- Print Range
- printRight("Counter: "..tostring(counter),3)
- printRight("Left Var: "..tostring(turnleftvar),4)
- printRight("Right Var: "..tostring(turnrightvar ),5)
- end
- function refuelme()
- if fuel < 25 then
- turtle.select(16)
- turtle.refuel(1)
- turtle.select(1)
- end
- end
- function drawMainMenu()
- printLeft2("1. Start", 7)
- printRight("8. Quit", 10)
- printLeft2("Selection: ", 12)
- selection = tonumber(read())
- end
- function tier()
- term.clear()
- term.setCursorPos(1,1)
- internalselection=0
- drawHeader()
- printLeft("Start Tiers", 7)
- printLeft("-------", 8)
- printLeft("1. Start", 9)
- printRight("3. Main Menu", 9)
- printLeft("Selection: ", 12)
- internalselection = tonumber(read())
- if internalselection==1 then
- term.clear()
- term.setCursorPos(1,1)
- for l = 0,4,1 do
- for j = 0,7,1 do
- refuelme()
- forward15()
- sleep(1)
- drawHeader()
- turnleftanddown()
- drawHeader()
- sleep(1)
- forward15()
- drawHeader()
- sleep(1)
- turnrightanddown()
- drawHeader()
- sleep(1)
- unload()
- end
- refuelme()
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- forward15()
- turtle.turnLeft()
- for k = 0,12,1 do
- refuelme()
- turtle.digUp()
- turtle.digUp()
- turtle.digUp()
- turtle.digUp()
- turtle.up()
- end
- end
- end
- end
- function forward15()
- term.clear()
- term.setCursorPos(1,1)
- drawHeader()
- refuelme()
- for i = 0,14,1 do
- turtle.dig()
- sleep(1)
- turtle.select(14)
- itemcompare = turtle.compare()
- if itemcompare == true then
- for m = 0,8,1 do
- turtle.dig()
- --printCentered("gravel",10)
- --printCentered(tostring(i),11)
- --printCentered(tostring(m),12)
- --printCentered(tostring(itemcompare),13)
- end
- sleep(1)
- end
- itemcompare = false
- turtle.select(1)
- turtle.forward()
- for k = 0,8,1 do
- turtle.digUp()
- end
- turtle.digDown()
- --printCentered(tostring(i),11)
- --printCentered(tostring(m),12)
- --printCentered(tostring(itemcompare),13)
- sleep(1)
- end
- end
- function unload()
- turtle.select(15)
- turtle.placeDown()
- turtle.select(1)
- turtle.dropDown(64)
- turtle.select(2)
- turtle.dropDown(64)
- turtle.select(3)
- turtle.dropDown(64)
- turtle.select(4)
- turtle.dropDown(64)
- turtle.select(5)
- turtle.dropDown(64)
- turtle.select(6)
- turtle.dropDown(64)
- turtle.select(7)
- turtle.dropDown(64)
- turtle.select(8)
- turtle.dropDown(64)
- turtle.select(9)
- turtle.dropDown(64)
- turtle.select(10)
- turtle.dropDown(64)
- turtle.select(11)
- turtle.dropDown(64)
- turtle.select(12)
- turtle.dropDown(64)
- turtle.select(13)
- turtle.dropDown(64)
- itemcount = turtle.getItemCount(14)
- itemcount = itemcount - 1
- turtle.select(14)
- turtle.dropDown(itemcount)
- turtle.digDown()
- turtle.select(1)
- turtle.transferTo(15)
- end
- function turnleftanddown()
- term.clear()
- term.setCursorPos(1,1)
- drawHeader()
- refuelme()
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- turtle.digDown()
- turtle.down()
- turtle.digDown()
- turnleftvar = 0
- turnrightvar = 1
- counter = counter + 1
- end
- function turnrightanddown()
- term.clear()
- term.setCursorPos(1,1)
- drawHeader()
- refuelme()
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- turtle.digDown()
- turtle.down()
- turtle.digDown()
- turnleftvar = 1
- turnrightvar = 0
- counter = counter + 1
- end
- function main()
- --PROGRAM START
- term.clear()
- term.setCursorPos(1,1)
- while true do
- drawHeader()
- drawMainMenu()
- refuelme()
- if selection==1 then
- tier()
- end
- if selection==8 then
- term.clear()
- term.setCursorPos(1,1)
- break
- end
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment