Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | None | 0 0
  1. local k = ""
  2. local p = ""
  3.  
  4. function chop()
  5. p = 0
  6.   for i = 1, 20 do
  7.     if turtle.detect()
  8.     then
  9.       turtle.digUp()
  10.       turtle.dig()
  11.       turtle.up()
  12.       p = p + 1
  13.     else
  14.       for i = 1, p do
  15.         turtle.down()
  16.       end  
  17.       break
  18.     end
  19.   end
  20. end
  21.  
  22. function check()
  23. turtle.up()
  24.   while not turtle.detect() do
  25.   sleep(5)
  26.   end
  27. turtle.down()
  28. end
  29.  
  30. function plant()
  31.   turtle.place()
  32.   redstone.setOutput( "right", true )
  33.   sleep(1)
  34.   redstone.setOutput( "right", false)
  35. end
  36.  
  37. ---Mainprog
  38. term.write("How many trees you want chopped?: ")
  39.   k = read()
  40.  
  41. for i = 1, k do
  42.   plant()
  43.   check()
  44.   chop()
  45.   print("Timber!!!")
  46.   sleep(3)
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement