UNOBTANIUM

uwct0.9.5 prerelease

Apr 3rd, 2013
967
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.39 KB | None | 0 0
  1. --MENU
  2. --VARIABLES
  3.  
  4. local version, savefile ,message = "ULTIMATE WOOD CHOPPER BETA 0.9.5 prerelease", "uwcvariables0.9.2",  ""
  5. local w,h = term.getSize()
  6. local id, distance, turtleslot = 15, 7, 1
  7. local running, chopping, usebonemeal = true, true, true
  8. local savestate, runningProgram = 0, ""
  9. turtle.select(turtleslot)
  10. rednet.open("right")
  11.  
  12.  
  13.  
  14. --VARIABLES
  15. cancelTimer = 2
  16. bonemealTimer = 120
  17. bonemealFirstDelay = 0
  18. amountMaxWoodSlotBonemeal = 14
  19. amountMaxWoodSlotNoBonemeal = 7
  20. amountMinBonemeal = 8
  21. amountMinSaplings = 17
  22. amountMinFuelLevel = 1200
  23. amountFurnaceWoodBonemeal = 16
  24. amountFurnaceWoodNoBonemeal = 8
  25. debugMaxHeight = 55
  26. usebonemeal = true
  27. persistence = true
  28. amountbonemealtimes = 1
  29.  
  30.  
  31. function loadVariables()
  32.  local file = fs.open(savefile,"r")
  33.  cancelTimer = tonumber(file.readLine())
  34.  bonemealTimer = tonumber(file.readLine())
  35.  bonemealFirstDelay = tonumber(file.readLine())
  36.  amountMaxWoodSlotBonemeal = tonumber(file.readLine())
  37.  amountMaxWoodSlotNoBonemeal = tonumber(file.readLine())
  38.  amountMinBonemeal = tonumber(file.readLine())
  39.  amountMinSaplings = tonumber(file.readLine())
  40.  amountMinFuelLevel = tonumber(file.readLine())
  41.  amountFurnaceWoodBonemeal = tonumber(file.readLine())
  42.  amountFurnaceWoodNoBonemeal = tonumber(file.readLine())
  43.  debugMaxHeight = tonumber(file.readLine())
  44.  local catchusebonemeal = file.readLine()
  45.  if catchusebonemeal == "true" then usebonemeal = true else usebonemeal = false end
  46.  distance = tonumber(file.readLine())
  47.  local catchpersistence = file.readLine()
  48.  if catchpersistence == "true" then persistence = true else persistence = false end
  49.  amountbonemealtimes = tonumber(file.readLine())
  50.  file.close()
  51. end
  52.  
  53. function saveVariables()
  54.  local file = fs.open(savefile,"w")
  55.  file.writeLine(cancelTimer)
  56.  file.writeLine(bonemealTimer)
  57.  file.writeLine(bonemealFirstDelay)
  58.  file.writeLine(amountMaxWoodSlotBonemeal)
  59.  file.writeLine(amountMaxWoodSlotNoBonemeal)
  60.  file.writeLine(amountMinBonemeal)
  61.  file.writeLine(amountMinSaplings)
  62.  file.writeLine(amountMinFuelLevel)
  63.  file.writeLine(amountFurnaceWoodBonemeal)
  64.  file.writeLine(amountFurnaceWoodNoBonemeal)
  65.  file.writeLine(debugMaxHeight)
  66.  file.writeLine(usebonemeal)
  67.  file.writeLine(distance)
  68.  file.writeLine(persistence)
  69.  file.writeLine(amountbonemealtimes)
  70.  for i=1,10 do
  71.   file.writeLine("-1")
  72.  end
  73.  file.close()
  74. end
  75.  
  76. function clearScreen()
  77.  term.clear()
  78.  term.setCursorPos(1,1)
  79.  term.clear()
  80. end
  81.  
  82. --RUN MENU
  83.  
  84. function runMenu()
  85.  while true do
  86.   clearScreen()
  87.   print("Rednet active! Waiting for message...")
  88.   id, message = rednet.receive()
  89.   sleep(0.1)
  90.   rednet.broadcast("started")
  91.   startProgram(message)
  92.  end
  93. end
  94.  
  95. function startProgram(input)
  96.  if input == "quit" then
  97.   running = false
  98.   runningProgram = ""
  99.   saveVariables()
  100.   return
  101.  elseif input == "standard" then
  102.   distance = 7
  103.   runningProgram = "standard"
  104.   saveSavePoint(0)
  105.   saveVariables()
  106.   chop()
  107.   runningProgram = ""
  108.   saveVariables()
  109.  elseif input == "expanded" then
  110.   distance = 9
  111.   runningProgram = "expanded"
  112.   saveSavePoint(0)
  113.   saveVariables()
  114.   chop()
  115.   runningProgram = ""
  116.   saveVariables()
  117.  elseif input == "debugstandard" then
  118.   distance = 7
  119.   UWCdebug()
  120.  elseif input == "debugexpanded" then
  121.   distance = 9
  122.   UWCdebug()
  123.  elseif input == "onebyone" then
  124.   FWConebyone()
  125.  elseif input == "twobytwo" then
  126.   FWCtwobytwo()
  127.  elseif input == "forward" then
  128.   turtle.forward()
  129.  elseif input == "back" then
  130.   turtle.back()
  131.  elseif input == "up" then
  132.   turtle.up()
  133.  elseif input == "down" then
  134.   turtle.down()
  135.  elseif input == "left" then
  136.   turtle.turnLeft()
  137.  elseif input == "right" then
  138.   turtle.turnRight()
  139.  elseif input == "refuel" then
  140.   turtle.refuel(1)
  141.  elseif input == "select" then
  142.   turtleslot = turtleslot + 1
  143.   if turtleslot > 16 then turtleslot = 1 end
  144.   turtle.select(turtleslot)
  145.  elseif input == "digup" then
  146.   turtle.digUp()
  147.  elseif input == "digfront" then
  148.   turtle.dig()
  149.  elseif input == "digdown" then
  150.   turtle.digDown()
  151.  elseif input == "godown" then
  152.   UWCgodown()
  153.  elseif input == "" then
  154.   return
  155.  elseif true then
  156.  end
  157. end
  158.  
  159.  
  160. --LAST SESSION
  161.  
  162. function saveSavePoint(i)
  163.  savestate = i
  164.  local file = fs.open("uwcsavepoint","w")
  165.  file.writeLine(savestate)
  166.  file.writeLine(runningProgram)
  167.  file.close()
  168. end
  169.  
  170. function loadSavePoint()
  171.  local file = fs.open("uwcsavepoint","r")
  172.  savestate = tonumber(file.readLine())
  173.  runningProgram = file.readLine()
  174.  file.close()
  175. end
  176.  
  177. function checkForLastSession()
  178.  if not fs.exists("uwcsavepoint") then return end
  179.  if not persistence then return end
  180.  loadSavePoint()
  181.  if savestate == 0 then
  182.   startProgram(runningProgram)
  183.   return
  184.  end
  185.  print("Turtle shutdown while it was working.")
  186.  while savestate > 0 do
  187.   if savestate >= 8 then
  188.    cutWood()
  189.   end
  190.   if savestate == 7 then
  191.    turtle.back()
  192.    saveSavePoint(2)
  193.    turtle.down()
  194.   end
  195.   if savestate == 2 then
  196.    saveSavePoint(4)
  197.    turtle.turnLeft()
  198.   end
  199.   if savestate == 4 then
  200.    saveSavePoint(1)
  201.    turtle.turnLeft()
  202.   end
  203.   if savestate == 3 then
  204.    saveSavePoint(1)
  205.    turtle.turnRight()
  206.   end
  207.   if savestate == 6 then
  208.    saveSavePoint(1)
  209.    turtle.turnRight()
  210.   end
  211.   if savestate == 1 then
  212.    while not turtle.detect() and max < 15 do turtle.forward() max = max + 1 end
  213.    if max == 15 then saveSavePoint(0) os.shutdown() end
  214.    saveSavePoint(5)
  215.   end
  216.   if savestate == 5 then
  217.    storeWood()
  218.    saveSavePoint(0)
  219.    turtle.turnRight()
  220.   end
  221.  end
  222.  startProgram(runningProgram)
  223. end
  224.  
  225. --ULTIMATE WOOD CHOPPER PROGRAMS
  226. --VARIABLES
  227. local dirtexpand, pipeexpand, obsidianpipeexpand, blockslot, coal, chest, furnace, dirt, pipe, ironpipe, goldpipe, obsidianpipe, woodenpipe, engine, lever, bonemeal, stone1, stone2, stone3, sapling, fuel = 2,3,4,5,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,3
  228.  
  229. --MOVE FUNCTIONS
  230.  
  231. function forward()
  232.  while not turtle.forward() do end
  233. end
  234.  
  235. function back()
  236.  while not turtle.back() do end
  237. end
  238.  
  239. function up()
  240.  while not turtle.up() do end
  241. end
  242.  
  243. function down()
  244.  while not turtle.down() do end
  245. end
  246.  
  247. --MAIN CHOP PROGRAM FUNCTIONS
  248.  
  249. function moveForward(j)
  250.  for i = 1,j do
  251.   forward()
  252.  end
  253. end
  254.  
  255. function moveForwardRemove(j)
  256.  for i = 1,j do
  257.   turtle.dig()
  258.   forward()
  259.  end
  260. end
  261.  
  262. function getCoal()
  263.  local delay = os.startTimer(cancelTimer)
  264.  print("Taking coal out of the chest!")
  265.  print("If nothing happens the chest has too less materials!")
  266.  print("Press Enter to terminate process!")
  267.  
  268.  while turtle.getFuelLevel() < amountMinFuelLevel do
  269.   event = { os.pullEvent() }
  270.   if event[1] == "timer" and event[2] == delay then
  271.    turtle.select(16)
  272.    turtle.suck()
  273.    if turtle.getItemCount(16) > 0 then  
  274.     turtle.refuel(math.ceil((amountMinFuelLevel - turtle.getFuelLevel())/80))
  275.     turtle.drop()
  276.     if turtle.getItemCount(16) > 0 then
  277.      turtle.select(16)
  278.      turtle.refuel()
  279.     end
  280.     if turtle.getFuelLevel() < amountMinFuelLevel then
  281.      delay = os.startTimer(2)
  282.     end
  283.    else
  284.     delay = os.startTimer(cancelTimer)
  285.    end
  286.   elseif event[1] == "key" and event[2] == 28 then
  287.    print("Terminated by User!")
  288.    clearScreen()
  289.    runningProgram = ""
  290.    saveSavePoint(0)
  291.    os.reboot()
  292.   end
  293.  end
  294.  print("Succesful!")
  295. end
  296.  
  297. function getSaplings()
  298.  local taking = true
  299.  local delay = os.startTimer(cancelTimer)
  300.  print("Taking saplings out of the chest!")
  301.  print("If nothing happens the chest has too less materials!")
  302.  print("Press Enter to terminate process!")
  303.  
  304.  while taking == true do
  305.   event = { os.pullEvent() }
  306.   if event[1] == "timer" and event[2] == delay then
  307.    if turtle.getItemCount(1) > 0 then
  308.     if turtle.getItemCount(2) > 0 then
  309.      turtle.select(1)
  310.      turtle.suck()
  311.      if turtle.getItemCount(3) > 0 then
  312.       turtle.select(3)
  313.       turtle.drop()
  314.      end
  315.     else
  316.      turtle.select(1)
  317.      turtle.suck()
  318.      if turtle.getItemCount(2) > 0 then
  319.       turtle.select(2)
  320.       turtle.drop()
  321.      end    
  322.     end
  323.    else
  324.     turtle.select(1)
  325.     turtle.suck()
  326.    end
  327.    if turtle.getItemCount(3) > 0 then
  328.     print("!!!!!!!!!")
  329.     print("The sapling chest is full! Please take out some stacks, otherwise you lose items! The turtle will drop them!")
  330.     print("!!!!!!!!!")
  331.     turtle.select(3)
  332.     turtle.dropDown()
  333.    end
  334.    if turtle.getItemCount(1) < amountMinSaplings then
  335.     delay = os.startTimer(cancelTimer)
  336.    else
  337.     taking = false
  338.    end
  339.   elseif event[1] == "key" and event[2] == 28 then
  340.    print("Terminated by User!")
  341.    turtle.turnRight()
  342.    forward()
  343.    turtle.turnRight()
  344.    clearScreen()
  345.    runningProgram = ""
  346.    saveSavePoint(0)
  347.    os.reboot()
  348.   end
  349.  end
  350.  print("Succesful!")
  351. end
  352.  
  353. function getBonemeal()
  354.  local taking = true
  355.  local delay = os.startTimer(cancelTimer)
  356.  print("Taking bonemeal out of the chest!")
  357.  print("If nothing happens the chest has too less materials!")
  358.  print("Press Enter to terminate process!")
  359.  
  360.  while taking == true do
  361.   event = { os.pullEvent() }
  362.   if usebonemeal == true then
  363.    if event[1] == "timer" and event[2] == delay then
  364.    if turtle.getItemCount(2) > 0 then
  365.     turtle.select(2)
  366.     turtle.suckUp()
  367.     if turtle.getItemCount(3) > 0 then
  368.      turtle.select(3)
  369.      turtle.dropUp()
  370.     end
  371.    else
  372.     turtle.select(2)
  373.     turtle.suckUp()
  374.    end
  375.     if turtle.getItemCount(3) > 0 then
  376.      print("!!!!!!!!!")
  377.      print("The bonemeal chest is full! Please take out some stacks, otherwise you lose items! The turtle will drop them!")
  378.      print("!!!!!!!!!")
  379.      turtle.select(3)
  380.      turtle.dropDown()
  381.     end
  382.     if turtle.getItemCount(2) < amountMinBonemeal then
  383.      delay = os.startTimer(cancelTimer)
  384.     else
  385.      taking = false
  386.     end
  387.    elseif event[1] == "key" and event[2] == 28 then
  388.     print("Terminated by User!")
  389.     turtle.turnRight()
  390.     forward()
  391.     turtle.turnRight()
  392.     clearScreen()
  393.     runningProgram = ""
  394.     saveSavePoint(0)
  395.     os.reboot()
  396.    end
  397.   else
  398.    turtle.select(2)
  399.    turtle.dropUp()
  400.    taking = false
  401.   end
  402.  end
  403.  print("Successful!")
  404. end
  405.  
  406. function storeWood()
  407.  print("Storing wood in the chests!")
  408.  chestfull = true
  409.  while chestfull == true do
  410.   if usebonemeal == true then
  411.    for i=3,16 do
  412.     if turtle.getItemCount(i) > 0 then
  413.      turtle.select(i)
  414.      chestfull = turtle.drop()
  415.     end
  416.    end
  417.   else
  418.    for i=2,16 do
  419.     if turtle.getItemCount(i) > 0 then
  420.      turtle.select(i)
  421.      chestfull = turtle.drop()
  422.     end
  423.    end
  424.   end
  425.  
  426.   chestfull = not chestfull
  427.    
  428.   if chestfull == true and turtle.detectUp() == true then
  429.    print("Wood! Wood everywhere!!!")
  430.    print("Your wood chests are full!")
  431.    print("Try to add more vertical chests or take wood out of them.")
  432.    print("")
  433.    chopping = false
  434.    while turtle.detectDown() == false do
  435.     down()
  436.    end
  437.    turtle.turnRight()
  438.   end
  439.  
  440.   if chestfull == true and turtle.detectUp() == false then
  441.    up()
  442.    print("This Chest is full!")
  443.   end
  444.  
  445.  end
  446.  
  447.  while turtle.detectDown() == false do
  448.  down()
  449.  end
  450.  
  451.  print("Successful stored the wood!")
  452.  print("")
  453. end
  454.  
  455. function treeGrew()
  456.  turtle.select(1)
  457.  if not turtle.compare() then
  458.   return true
  459.  else
  460.   return false
  461.  end
  462. end
  463.  
  464. function plantTree()
  465.  print("Planting saplings!")
  466.  turtle.select(1)
  467.  moveForwardRemove(2)
  468.  saveSavePoint(6)
  469.  turtle.turnRight()
  470.  turtle.place()
  471.  saveSavePoint(2)
  472.  turtle.turnLeft()
  473.  back()
  474.  turtle.place()
  475.  saveSavePoint(6)
  476.  turtle.turnRight()
  477.  turtle.place()
  478.  saveSavePoint(2)
  479.  turtle.turnLeft()
  480.  back()
  481.  turtle.place()
  482.  if usebonemeal then
  483.   sleep(bonemealFirstDelay)
  484.  end
  485.  local treeNotGrown = true
  486.  while treeNotGrown and turtle.getItemCount(2) > amountbonemealtimes + 1 do
  487.   if usebonemeal then
  488.    print("Fertilizing the tree with bonemeal!")
  489.    turtle.select(2)
  490.    for i=1,amountbonemealtimes do
  491.     turtle.place()
  492.     sleep(1)
  493.    end
  494.   end
  495.   if not treeGrew() then
  496.    print("Tree didnt grew yet!")
  497.    print("Will try again in " .. bonemealTimer .." seconds...")
  498.    back()
  499.    sleep(bonemealTimer)
  500.    forward()
  501.   else
  502.    treeNotGrown = false
  503.   end
  504.  end
  505.  print("Successful planted new tree!")
  506.  print("")
  507. end
  508.  
  509.  
  510. function getMaterials()
  511.  saveSavePoint(4)
  512.  turtle.turnLeft()
  513.  saveSavePoint(1)
  514.  turtle.turnLeft()
  515.  moveForward(distance)
  516.  
  517.  turtle.select(3)
  518.  if usebonemeal then
  519.   turtle.dropDown(amountFurnaceWoodBonemeal)
  520.  else
  521.   turtle.dropDown(amountFurnaceWoodNoBonemeal)
  522.  end
  523.  saveSavePoint(5)
  524.  storeWood()
  525.  
  526.  saveSavePoint(0)
  527.  turtle.turnRight()
  528.    
  529.  if redstone.getInput("back") == false then
  530.   print("Shutdown by redstone signal!")
  531.   chopping = false
  532.   runningProgram = ""
  533.   saveSavePoint(0)
  534.  else
  535.   getCoal()
  536.   saveSavePoint(2)
  537.   turtle.turnRight()
  538.   turtle.forward()
  539.   saveSavePoint(3)
  540.   turtle.turnRight()  
  541.   getSaplings()
  542.   getBonemeal()
  543.   saveSavePoint(2)
  544.   turtle.turnLeft()
  545.   moveForward(distance-1)
  546.  end
  547. end
  548.  
  549. function chopUp()
  550.  turtle.dig()
  551.  while turtle.detectUp() do
  552.   turtle.digUp()
  553.   up()
  554.   turtle.dig()
  555.  end
  556. end
  557.  
  558. function chopDown()
  559.  turtle.dig()
  560.  while turtle.detectDown() do
  561.   turtle.digDown()
  562.   down()
  563.   turtle.dig()
  564.  end
  565.  saveSavePoint(104)
  566.  down()
  567.  turtle.dig()
  568. end
  569.  
  570. function cutWood()
  571.  print("Chopping down the tree!")
  572.  turtle.select(1)
  573.  if savestate == 2 then
  574.   turtle.dig()
  575.   saveSavePoint(100)
  576.   forward()
  577.  end
  578.  if savestate == 100 then
  579.   saveSavePoint(101)
  580.   turtle.turnRight()
  581.  end
  582.  if savestate == 101 then
  583.   turtle.dig()
  584.   saveSavePoint(102)
  585.   turtle.turnLeft()
  586.  end
  587.  if savestate == 102 then
  588.   chopUp()
  589.   saveSavePoint(8)
  590.   turtle.turnRight()
  591.  end
  592.  print("Reached the top of the tree!")
  593.  if savestate == 8 then
  594.   turtle.dig()
  595.   saveSavePoint(9)
  596.   forward()
  597.  end
  598.  if savestate == 9 then
  599.   saveSavePoint(103)
  600.   turtle.turnLeft()
  601.  end
  602.  if savestate == 103 then
  603.   chopDown()
  604.   saveSavePoint(10)
  605.   back()
  606.  end
  607.  if savestate == 104 then
  608.   turtle.dig()
  609.   saveSavePoint(10)
  610.   back()
  611.  end
  612.  print("Successful chopped the tree!")
  613.  print("")
  614.  if savestate == 10 then
  615.   saveSavePoint(11)
  616.   turtle.turnLeft()
  617.  end
  618.  if savestate == 11 then
  619.   saveSavePoint(12)
  620.   forward()
  621.  end
  622.  if savestate == 12 then
  623.   saveSavePoint(2)
  624.   turtle.turnRight()
  625.  end
  626. end
  627.  
  628.  
  629. function chop()
  630.  if redstone.getInput("back") == true then
  631.   saveSavePoint(0)
  632.   print("Starting the Fir Wood Chooper program!")
  633.   getCoal()
  634.   if turtle.getItemCount(3) > 0 or turtle.getItemCount(16) > 0 then
  635.    saveSavePoint(1)
  636.    turtle.turnLeft()
  637.    storeWood()
  638.    saveSavePoint(0)
  639.    turtle.turnRight()
  640.   end
  641.   saveSavePoint(2)
  642.   turtle.turnRight()
  643.   forward()
  644.   saveSavePoint(3)
  645.   turtle.turnRight()
  646.   if turtle.getItemCount(1) < amountMinSaplings then
  647.    getSaplings()
  648.   end
  649.   if turtle.getItemCount(2) < amountMinBonemeal and usebonemeal == true then
  650.    getBonemeal()
  651.   end
  652.   if turtle.getItemCount(2) > 0 and usebonemeal == false then
  653.    turtle.select(2)
  654.    turtle.dropUp()
  655.   end
  656.   saveSavePoint(1)
  657.   turtle.turnRight()
  658.   forward()
  659.   saveSavePoint(0)
  660.   turtle.turnRight()
  661.   saveSavePoint(2)
  662.   turtle.turnRight()
  663.   moveForward(distance)
  664.  
  665.   while chopping == true do
  666.    local needMaterials = false
  667.    if turtle.getFuelLevel() < 200 then
  668.     needMaterials = true
  669.     print("Have to refuel!")
  670.    end
  671.    if turtle.getItemCount(1) < amountMinSaplings then
  672.     needMaterials = true
  673.     print("Need more Saplings!")
  674.    end
  675.    if turtle.getItemCount(2) < amountMinBonemeal and usebonemeal then
  676.     needMaterials = true
  677.     print("Need more bonemeal!")
  678.    end
  679.    if usebonemeal and turtle.getItemCount(amountMaxWoodSlotBonemeal) > 0 then
  680.     needMaterials = true
  681.     print("Enough wood harvested!")
  682.    end
  683.    if usebonemeal == false and turtle.getItemCount(amountMaxWoodSlotNoBonemeal) > 0 then
  684.     needMaterials = true
  685.     print("Enough wood harvested!")
  686.    end
  687.    if needMaterials == true then
  688.     getMaterials()
  689.    end
  690.    if chopping == true then
  691.     plantTree()
  692.     cutWood()
  693.    end
  694.   end
  695.  else
  696.   runningProgram = ""
  697.   saveSavePoint(0)
  698.  end
  699.  chopping = true
  700. end
  701.  
  702. --MAIN DEBUG FUNCTIONS
  703.  
  704. function UWCdebug()
  705.  getCoal()
  706.  turtle.turnRight()
  707.  moveForward(distance)
  708.  local height = 0
  709.  turtle.select(1)
  710.  turtle.dig()
  711.  forward()
  712.  turtle.dig()
  713.  while not turtle.detectUp() and height < debugMaxHeight do
  714.   turtle.up()
  715.   height = height + 1
  716.  end
  717.  turtle.dig()
  718.  while turtle.detectUp() do
  719.   turtle.digUp()
  720.   turtle.up()
  721.   turtle.dig()
  722.   height = height + 1
  723.  end
  724.  turtle.turnRight()
  725.  turtle.dig()
  726.  forward()
  727.  turtle.turnLeft()
  728.  turtle.dig()
  729.  while height > 0 do
  730.   turtle.digDown()
  731.   down()
  732.   turtle.dig()
  733.   height = height - 1
  734.  end
  735.  back()
  736.  turtle.turnLeft()
  737.  forward()
  738.  turtle.turnLeft()
  739.  moveForward(distance)
  740.  turtle.turnRight()
  741.  print("Debug finished! Please take the wood out of the inventory!")
  742.  print("Press Enter to get back into the menu!")
  743.  read()
  744. end
  745.  
  746. function FWCtwobytwo()
  747.  print("Chopping down 2x2 tree.")
  748.  while turtle.getFuelLevel() < 200 do
  749.   sleep(2)
  750.   turtle.select(1)
  751.   turtle.refuel(1)
  752.   print("Refueled!")
  753.  end
  754.  savestate = 2
  755.  cutWood()
  756. end
  757.  
  758. --FWConebyone
  759.  
  760. function FWConebyone()
  761.  print("Chopping down 1x1 tree.")
  762.  while turtle.getFuelLevel() < 200 do
  763.   sleep(2)
  764.   turtle.select(1)
  765.   turtle.refuel(1)
  766.   print("Refueled!")
  767.  end
  768.  turtle.select(2)
  769.  turtle.dig()
  770.  forward()
  771.  while turtle.compareUp() do
  772.   turtle.digUp()
  773.   up()
  774.  end
  775.  while not turtle.detectDown() do
  776.   turtle.down()
  777.  end
  778. end
  779.  
  780. function UWCgodown()
  781.  while not turtle.detectDown() do
  782.   turtle.down()
  783.  end
  784. end
  785.  
  786. --MAIN PROGRAM
  787.  
  788. if fs.exists(savefile) then
  789.  loadVariables()
  790. end
  791.  
  792. checkForLastSession()
  793.  
  794. while running == true do
  795.  runMenu()
  796. end
Advertisement
Add Comment
Please, Sign In to add comment