Advertisement
HawkPB

log chopping code

Jun 27th, 2025 (edited)
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1. print("hawks cool ass automatic tree farm")
  2. turtle.select(8)
  3. turtle.refuel()
  4.  
  5. local chopped = 0
  6. if fs.exists("amount") then
  7.    local filer = fs.open("amount","r")
  8.     chopped = tonumber((filer.readAll() or "") or "0")
  9.     filer.close()
  10. end
  11. chopped = chopped or 0
  12.  
  13. while true do
  14.  
  15.     turtle.select(3) -- sappling
  16.     turtle.place()
  17.     turtle.select(2) -- log
  18.     local i = 0
  19.     while not turtle.compare() do
  20.         os.sleep(1)
  21.         i = i + 1
  22.         if i>10 then
  23.             print("Fuel: "..turtle.getFuelLevel())
  24.             print("Trees Chopped: "..chopped)
  25. i = 0
  26.  
  27.         end    
  28.     end
  29. local y = 0
  30.     while turtle.compare() do
  31.         turtle.dig()
  32. turtle.digUp()
  33. turtle.up()
  34. y = y + 1
  35.     end
  36. for i=1,y do turtle.down() end
  37. chopped = chopped + 1
  38. local filew = fs.open("amount","w")
  39.  filew.write(tostring(chopped))
  40.     filew.close()
  41. turtle.select(8)
  42. turtle.refuel()
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement