Advertisement
SubTox1c

Farmer Joe

Apr 4th, 2014
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.59 KB | None | 0 0
  1. function textOutput(output_message, x_screen_pos, z_screen_pos, clear_area)
  2.         term.setCursorPos(x_screen_pos,z_screen_pos)
  3.         if clear_area == 0 then
  4.                 clear_area = string.len(output_message)
  5.         end    
  6.         write(output_message..string.rep(" ", (clear_area - string.len(output_message))))
  7. end
  8.  
  9.  
  10. function farm()
  11.     turtle.select(1)
  12.     turtle.forward()
  13.     turtle.digDown()
  14.     turtle.placeDown()
  15. end
  16.  
  17. function right()
  18.     turtle.turnRight()
  19.     farm()
  20.     turtle.turnRight()
  21. end
  22.  
  23. function left()
  24.     turtle.turnLeft()
  25.     farm()
  26.     turtle.turnLeft()
  27. end
  28.  
  29. function home()
  30.     turtle.turnLeft()
  31.     turtle.forward()
  32.     turtle.forward()
  33.     turtle.turnLeft()
  34.     turtle.forward()
  35.     turtle.forward()
  36.     turtle.forward()
  37. end
  38.  
  39. function refuel()
  40.     if turtle.getFuelLevel() < 100 then
  41.         turtle.select(16)
  42.         turtle.suck()
  43.         turtle.refuel()
  44.     end
  45. end
  46.  
  47.  
  48. function stock()
  49.     for i = 2,15 do
  50.         turtle.select(i)
  51.         turtle.dropDown()
  52.     end
  53.     turtle.turnLeft()
  54.     refuel()
  55.     turtle.turnLeft()
  56. end
  57.  
  58. function farming()
  59.     farm()
  60.     farm()
  61.     farm()
  62.     right()
  63.     farm()
  64.     farm()
  65.     left()
  66.     farm()
  67.     farm()
  68.     home()
  69.     stock()
  70. end
  71.  
  72. function border()
  73.     term.setCursorPos(1,1)
  74.     print "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"
  75.     term.setCursorPos(1,12)
  76.     print "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"
  77. end
  78.  
  79. term.clear()
  80.    
  81.  term.setCursorPos(18,9)
  82.  textOutput("Press enter to start", 1, 9, 0)
  83.  z = 0
  84. while z < 1 do
  85.         press, key = os.pullEvent()
  86.         if press == "key" and key == 28 then
  87.                 break
  88.         end    
  89. end
  90.  
  91. term.clear()
  92.  
  93. while true do
  94.     farming()
  95.     sleep(60)
  96. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement