Advertisement
MrTurtle

lumberjack

May 24th, 2014
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.15 KB | None | 0 0
  1. print("Loading Robust Turtle API...")
  2. local load = os.loadAPI("t")
  3. if load then
  4.   print("Robust Turtle API loaded.")
  5. else
  6.  print("Robust Turtle API not found in the root directory with filename t")
  7.  print("Attempting to download as t from pastebin...")
  8.  os.sleep(2)
  9.  local response = http.get("http://pastebin.com/raw.php?i= e0UksEtT")
  10.  if response then
  11.     print( "Success." )    
  12.     local sResponse = response.readAll()
  13.     response.close()
  14.     local file = fs.open( "t", "w" )
  15.     file.write( sResponse )
  16.     file.close()
  17.     print( "Downloaded as t")
  18.     load = os.loadAPI("t")
  19.     if load then
  20.      print("Robust Turtle API installed & loaded.")
  21.     end
  22.  else
  23.     print( "Download Failed. Please Install Manually." )
  24.     return
  25.  end
  26. end
  27.  
  28.  
  29. --1x1 lumberjack turtle. Can use bonemeal or not. Burns Leaves.
  30. --updated 5/25/2014
  31.  
  32.  
  33. local bm = "_"
  34. local wood, sapling, meal, flint = 1,2,3,9
  35. function burn()
  36.  for i=1,4 do
  37.   t.place(flint)
  38.   t.right()
  39.  end
  40. end
  41.  
  42. while bm~="y" and bm~="yes" and bm~="n" and bm~="no" do
  43.  term.clear()
  44.  term.setCursorPos(1,1)
  45.  print("LumberJack Turtle.")
  46.  print("Will "..os.getComputerLabel().." be using bonemeal(y/n)?")
  47.  bm=read()
  48. end
  49. if bm=="yes" then
  50. bm="y"
  51. elseif bm=="no" then
  52. bm="n"
  53. end
  54. if bm=="y" then
  55. print("Place a block of wood in slot 1, saplings in slot 2, bonemeal in slot 3 and flint&steel in slot 9.")
  56. elseif bm=="n" then
  57. print("Place a block of wood in slot 1, saplings in slot 2 and flint&steel in slot 9.")
  58. end
  59. read()
  60.  
  61.  
  62. while true do
  63. height = 0
  64. wait = 0
  65. if not t.compare(wood) then
  66.  t.place(sapling)
  67. end
  68. while not t.compare(wood) do
  69.  sleep(2)
  70.  wait = wait + 1
  71.  term.clear()
  72.  term.setCursorPos(1,1)
  73.  print("Waiting for growth.")
  74.  if bm=="y" then
  75.   t.restack(meal)
  76.   turtle.select(meal)
  77.   turtle.place()
  78.   print(wait.." bonemeals placed for this sapling so far.")
  79.  elseif bm=="n" then
  80.   print("It's been "..2*wait.." seconds since this sapling was planted.")
  81.  end
  82. end
  83. print("Jacking Lumber...")
  84. t.forward()
  85. while t.compareUp(wood) do
  86.   t.up()
  87.   height = height + 1
  88. end
  89. for i = 1, height do
  90.   t.down()
  91.   if i==2 then burn() end
  92. end
  93. t.back()
  94. end--end infinite loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement