Advertisement
MrTurtle

Pumpkin/Melon Farmer

Jun 21st, 2014
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.66 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("Great Success.")    
  12.     local data = response.readAll()
  13.     response.close()
  14.     local file = fs.open("t", "w")
  15.     file.write(data)
  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 from http://pastebin.com/u/MrTurtle." )
  24.     return
  25.  end
  26. end
  27. --farms pumpkins/melons in alternating rows
  28. print("Place "..os.getComputerLabel().." above the block of wood.")
  29. read()
  30. local rows = 4
  31. local rowL = 8
  32. local wait = 60
  33. t.forward()
  34. t.up()
  35. while true do
  36.   local side = "right"
  37.   for i=1, rows do
  38.     t.forward()
  39.     for i=1,rowL do
  40.       t.digDown()
  41.       t.forward()
  42.       --t.suckDown()
  43.     end
  44.     if side=="left" and i~=rows then
  45.       t.goLeft(2)
  46.       t.left()
  47.       side="right"
  48.     elseif side=="right" and i~=rows then
  49.       t.goRight(2)
  50.       t.right()
  51.       side="left"
  52.     elseif side=="left" and i==rows then
  53.       t.goRight(2*(rows-1))
  54.       t.right()
  55.     elseif side=="right" and i==rows then
  56.       t.strafeLeft(2*(rows-1))
  57.       t.back(rowL+1)
  58.     end
  59.   end
  60.   for i=wait, 0, -1 do
  61.     term.clear()
  62.     term.setCursorPos(1,1)
  63.     print("Waiting "..i.." seconds to allow for growth.")
  64.     sleep(1)
  65.   end
  66. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement