Advertisement
Kengu

Untitled

Dec 10th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. run = false
  2. print("**Farming area is meant to be a rectangle**")
  3. print("**Turtle should start at the bottom left of the farm plot behind first crop**")
  4.  
  5. io.write("What is the crop type: ")
  6. croptype = (tostring(io.read()))
  7. io.write("How many blocks forward: ")
  8. blocksforward = (tonumber(io.read()))
  9. io.write("How many blocks to the right: ")
  10. blocksright = (tonumber(io.read()))
  11. x = 0
  12. y = 0
  13.  
  14. if croptype == "hemp" then
  15. run = true
  16. else
  17. print("INVALID")
  18. end
  19.  
  20. while run do
  21. local event, param = os.pullEvent()
  22. if event == "key" and param == 28 then
  23. print("Process terminated")
  24. break
  25. elseif turtle.detect() then
  26. if x < blocksforward then
  27. turtle.dig()
  28. turtle.forward()
  29. x = x + 1
  30. elseif x == blocksforward then
  31. turtle.turnRight()
  32. elseif y < blocksright and x == blocksforward then
  33. turtle.dig()
  34. turtle.forward()
  35. y = y + 1
  36. else
  37. print("error")
  38. end
  39.  
  40.  
  41.  
  42. end
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement