Advertisement
SuPeRMiNoR3

[ComputerCraft] Turtle Tiller

Feb 6th, 2013
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.94 KB | None | 0 0
  1. function clear()
  2.     term.clear()
  3.     term.setCursorPos(1,1)
  4. end
  5.  
  6. function loop(func, am)
  7. if am == nil then
  8.     am = 1
  9. end
  10. for i = 1, am do
  11.         s = false
  12.         while s == false do
  13.             s = func()
  14.             sleep(0.1)
  15.         end
  16.     end
  17. end
  18.  
  19.  
  20. function tillF(am)
  21. if turtle.detectDown() == true then
  22. loop(turtle.up)
  23. end
  24. for i = 1, am do
  25.         loop(turtle.digDown)
  26.         loop(turtle.forward)
  27.     end
  28. end
  29.  
  30. function main()
  31. while true do
  32. clear()
  33. write("Turtle Command> ")
  34. inp = read()
  35. if inp == "till" then
  36.     clear()
  37.     write("Amount> ")
  38.     inp = read()
  39.     tillF(tonumber(inp))
  40. end
  41. if inp == "tun" then
  42. while true do
  43. shell.run("tunnel","10")
  44. turtle.turnLeft()
  45. turtle.turnLeft()
  46. turtle.digDown()
  47. turtle.down()
  48. turtle.digDown()
  49. turtle.down()
  50. end
  51. end
  52. if inp == "help" then
  53.     clear()
  54.     print("Help:")
  55.     print("Type till to till some ground, thats all I have right now.")
  56.     print("Press any key to exit.")
  57.     i = os.pullEvent()
  58.     main()
  59. end
  60.  
  61. end
  62. end
  63.  
  64.  
  65. shell.run("farm")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement