Advertisement
MrTurtle

obsidian_miner

May 24th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.75 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.  
  30. --obsidian floor harvesting turtle
  31. --can also be used to harvest block layers
  32.  
  33. write("Place turtle above a corner of the obsidian layer.")
  34. print("")
  35. write("Is the rest of the layer to the right or left of the turtle? ")
  36. local block = 1
  37. local turn = read()
  38. while turn ~= "left" and turn ~= "right" do
  39.  print("Please enter left or right")
  40.  turn = read()
  41. end
  42. write("How many rows of obsidian? ")
  43. local rows = term.readNum()
  44. t.down()
  45. for i=1, rows do
  46.  if turn == "left" then
  47.   while t.compare(1) or t.compareLeft(1) do
  48.    t.digUp()
  49.    t.forward()
  50.   end
  51.   turtle.turnLeft()
  52.   t.digUp()
  53.   t.forward()
  54.   turtle.turnLeft()
  55.   turn = "right"
  56.  elseif turn == "right" then
  57.   while t.compare(1) or t.compareRight(1) do
  58.   t.digUp()
  59.   t.forward()
  60.   end
  61.   turtle.turnRight()
  62.   t.digUp()
  63.   t.forward()
  64.   turtle.turnRight()
  65.   turn = "left"
  66.  end
  67. local tries = 0
  68.  while not turtle.compare() do
  69.   t.digUp()
  70.   t.forward()
  71.   tries = tries+1
  72.   if tries > 10 then
  73.    break
  74.   end
  75.  end
  76. end
  77. t.up()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement