Advertisement
Kengu

Untitled

Dec 10th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 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. z = 0
  14.  
  15. if croptype == "hemp" then
  16. run = true
  17. else
  18. print("INVALID")
  19. end
  20.  
  21. while run do
  22. local event, param = os.pullEvent()
  23. if event == "key" and param == 28 then
  24. print("Process terminated")
  25. break
  26.  
  27. elseif x < blocksforward then
  28. turtle.dig()
  29. turtle.forward()
  30. x = x + 1
  31. elseif x == blocksforward then
  32. turtle.turnRight()
  33. z = z + 1
  34. elseif y < blocksright and z == 1 then
  35. turtle.dig()
  36. turtle.forward()
  37. y = y + 1
  38. else
  39. print("error")
  40. end
  41.  
  42.  
  43.  
  44. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement