Illprotectjew

UWC

Oct 27th, 2013
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.42 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, false
  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("Successfully chopped the tree!")
  613. rednet.broadcast("clear")
  614.  print("")
  615.  if savestate == 10 then
  616.   saveSavePoint(11)
  617.   turtle.turnLeft()
  618.  end
  619.  if savestate == 11 then
  620.   saveSavePoint(12)
  621.   forward()
  622.  end
  623.  if savestate == 12 then
  624.   saveSavePoint(2)
  625.   turtle.turnRight()
  626.  end
  627. end
  628.  
  629.  
  630. function chop()
  631.  if redstone.getInput("back") == true then
  632.   saveSavePoint(0)
  633.   print("Starting the Fir Wood Chooper program!")
  634.   getCoal()
  635.   if turtle.getItemCount(3) > 0 or turtle.getItemCount(16) > 0 then
  636.    saveSavePoint(1)
  637.    turtle.turnLeft()
  638.    storeWood()
  639.    saveSavePoint(0)
  640.    turtle.turnRight()
  641.   end
  642.   saveSavePoint(2)
  643.   turtle.turnRight()
  644.   forward()
  645.   saveSavePoint(3)
  646.   turtle.turnRight()
  647.   if turtle.getItemCount(1) < amountMinSaplings then
  648.    getSaplings()
  649.   end
  650.   if turtle.getItemCount(2) < amountMinBonemeal and usebonemeal == true then
  651.    getBonemeal()
  652.   end
  653.   if turtle.getItemCount(2) > 0 and usebonemeal == false then
  654.    turtle.select(2)
  655.    turtle.dropUp()
  656.   end
  657.   saveSavePoint(1)
  658.   turtle.turnRight()
  659.   forward()
  660.   saveSavePoint(0)
  661.   turtle.turnRight()
  662.   saveSavePoint(2)
  663.   turtle.turnRight()
  664.   moveForward(distance)
  665.  
  666.   while chopping == true do
  667.    local needMaterials = false
  668.    if turtle.getFuelLevel() < 200 then
  669.     needMaterials = true
  670.     print("Have to refuel!")
  671.    end
  672.    if turtle.getItemCount(1) < amountMinSaplings then
  673.     needMaterials = true
  674.     print("Need more Saplings!")
  675.    end
  676.    if turtle.getItemCount(2) < amountMinBonemeal and usebonemeal then
  677.     needMaterials = true
  678.     print("Need more bonemeal!")
  679.    end
  680.    if usebonemeal and turtle.getItemCount(amountMaxWoodSlotBonemeal) > 0 then
  681.     needMaterials = true
  682.     print("Enough wood harvested!")
  683.    end
  684.    if usebonemeal == false and turtle.getItemCount(amountMaxWoodSlotNoBonemeal) > 0 then
  685.     needMaterials = true
  686.     print("Enough wood harvested!")
  687.    end
  688.    if needMaterials == true then
  689.     getMaterials()
  690.    end
  691.    if chopping == true then
  692.     plantTree()
  693.     cutWood()
  694.    end
  695.   end
  696.  else
  697.   runningProgram = ""
  698.   saveSavePoint(0)
  699.  end
  700.  chopping = true
  701. end
  702.  
  703. --MAIN DEBUG FUNCTIONS
  704.  
  705. function UWCdebug()
  706.  getCoal()
  707.  turtle.turnRight()
  708.  moveForward(distance)
  709.  local height = 0
  710.  turtle.select(1)
  711.  turtle.dig()
  712.  forward()
  713.  turtle.dig()
  714.  while not turtle.detectUp() and height < debugMaxHeight do
  715.   turtle.up()
  716.   height = height + 1
  717.  end
  718.  turtle.dig()
  719.  while turtle.detectUp() do
  720.   turtle.digUp()
  721.   turtle.up()
  722.   turtle.dig()
  723.   height = height + 1
  724.  end
  725.  turtle.turnRight()
  726.  turtle.dig()
  727.  forward()
  728.  turtle.turnLeft()
  729.  turtle.dig()
  730.  while height > 0 do
  731.   turtle.digDown()
  732.   down()
  733.   turtle.dig()
  734.   height = height - 1
  735.  end
  736.  back()
  737.  turtle.turnLeft()
  738.  forward()
  739.  turtle.turnLeft()
  740.  moveForward(distance)
  741.  turtle.turnRight()
  742.  print("Debug finished! Please take the wood out of the inventory!")
  743.  print("Press Enter to get back into the menu!")
  744.  read()
  745. end
  746.  
  747. function FWCtwobytwo()
  748.  print("Chopping down 2x2 tree.")
  749.  while turtle.getFuelLevel() < 200 do
  750.   sleep(2)
  751.   turtle.select(1)
  752.   turtle.refuel(1)
  753.   print("Refueled!")
  754.  end
  755.  savestate = 2
  756.  cutWood()
  757. end
  758.  
  759. --FWConebyone
  760.  
  761. function FWConebyone()
  762.  print("Chopping down 1x1 tree.")
  763.  while turtle.getFuelLevel() < 200 do
  764.   sleep(2)
  765.   turtle.select(1)
  766.   turtle.refuel(1)
  767.   print("Refueled!")
  768.  end
  769.  turtle.select(2)
  770.  turtle.dig()
  771.  forward()
  772.  while turtle.compareUp() do
  773.   turtle.digUp()
  774.   up()
  775.  end
  776.  while not turtle.detectDown() do
  777.   turtle.down()
  778.  end
  779. end
  780.  
  781. function UWCgodown()
  782.  while not turtle.detectDown() do
  783.   turtle.down()
  784.  end
  785. end
  786.  
  787. --MAIN PROGRAM
  788.  
  789. if fs.exists(savefile) then
  790.  loadVariables()
  791. end
  792.  
  793. checkForLastSession()
  794.  
  795. while running == true do
  796.  runMenu()
  797. end
Advertisement
Add Comment
Please, Sign In to add comment