Advertisement
sasaa86

Computercraft logging script

Aug 24th, 2017
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.32 KB | None | 0 0
  1. -- Logging program
  2. -- Not finished
  3.  
  4. function check()
  5.     local success, data = turtle.inspect()
  6.     return data.name
  7. end
  8. function checkUp()
  9.     local success, data = turtle.inspectUp()
  10.     return data.name
  11. end
  12. function checkDown()
  13.     local success, data = turtle.inspectDown()
  14.     return data.name
  15. end
  16.  
  17.  
  18. if check() == "log" then
  19.     turtle.dig()
  20.     turtle.forward()
  21.     while checkUp() == "log" do
  22.         turtle.digup()
  23.         if check() == "log" then
  24.             turtle.dig()
  25.         end
  26.         turtle.up()
  27.     end
  28.     turtle.turnRight()
  29.     if check() == "log" then                -- check if its a 2x2 tree on the right
  30.         turtle.dig()
  31.         turtle.forward()
  32.         turtle.turnLeft()
  33.         while checkDown() == "log" do
  34.             turtle.digDown()
  35.             if check() == "log" then
  36.                 turtle.dig()
  37.             end
  38.             turtle.down()
  39.         end
  40.         if check() == "log" then
  41.             turtle.dig()
  42.         end
  43.     end
  44.     turtle.turnLeft()
  45.     turtle.turnLeft()
  46.     if check() == "log" then                -- check if its a 2x2 tree on the left
  47.         turtle.dig()
  48.         turtle.forward()
  49.         turtle.turnRight()
  50.         while checkDown() == "log" do
  51.             turtle.digDown()
  52.             if check() == "log" then
  53.                 turtle.dig()
  54.             end
  55.             turtle.down()
  56.         end
  57.         if check() == "log" then
  58.             turtle.dig()
  59.         end
  60.     else
  61.         turtle.turnLeft()
  62.         while turtle.down()
  63.             -- nothing
  64.         end
  65.     end
  66.     turtle.back()
  67. else
  68.     print("no tree found?")
  69.     print("Place me against a tree please.")
  70. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement