Advertisement
MrTurtle

junglelumberjack

May 24th, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.30 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. --code needs work as i dont know how to regrow 2x2 trees consistently
  30. --I probably could just google it. You could too, don't be Lazy. Jeez.
  31.  
  32. local bm = "_"
  33. local wood, sapling, meal, flint = 1,2,3,9
  34. while bm~="y" and bm~="yes" and bm~="n" and bm~="no" do
  35.  term.clear()
  36.  term.setCursorPos(1,1)
  37.  print("2x2 Jungle LumberJack Turtle.")
  38.  print("Will "..os.getComputerLabel().." be using bonemeal(y/n)?")
  39.  bm=read()
  40. end
  41. if bm=="y" bm=="yes" then
  42. print("Place a block of jungle wood in slot 1, 4 saplings in slot 2, bonemeal in slot 3 and flint&steel in slot 9.")
  43. elseif bm=="n" bm=="no" then
  44. print("Place a block of jungle wood in slot 1 and 4 saplings in slot 2 and flint&steel in slot 11.")
  45. end
  46. read()
  47.  
  48.  
  49. while true do
  50. height = 0
  51. wait = 0
  52. if not t.compare(wood) then
  53.  t.forward()
  54.  t.place(sapling)
  55.  t.strafeRight()
  56.  t.place(sapling)
  57.  t.back()
  58.  t.place(sapling)
  59.  t.strafeLeft()
  60.  t.place(sapling)
  61. end
  62. while not t.compare(wood) do
  63.  sleep(1)
  64.  wait = wait + 1
  65.  term.clear()
  66.  term.setCursorPos(1,1)
  67.  print("Waiting for growth.")
  68.  if bm=="y" then
  69.   t.restack(meal)
  70.   turtle.select(meal)
  71.   turtle.place()
  72.   print(wait.." bonemeals placed for this sapling so far.")
  73.  elseif bm=="n" then
  74.   print("It's been "..wait.." seconds since this sapling was planted.")
  75.  end
  76. end
  77. t.forward()
  78. while t.compare(wood) do
  79.   t.dig()
  80.   t.up()
  81.   height = height + 1
  82. end
  83. t.left()
  84. t.place(flint)
  85. t.right()
  86. t.strafeRight()
  87. t.right()
  88. t.place(flint)
  89. t.left()
  90. for i = 1, height, 1 do
  91.   t.down()
  92.   t.dig()
  93. end
  94. t.strafeLeft()
  95. t.back()
  96. end--end infinite loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement