Advertisement
Mackan90096

Turtlecontrollerclien

Mar 5th, 2013
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.50 KB | None | 0 0
  1. -- Settings --
  2. bgcolor = 16384 -- Backgroundcolor Default = 16384 (red)
  3. textcolor = 32768 -- Textcolor Default = 32768 (Black)
  4. mside = "top" -- Side of modem.
  5. turtleid = 89 -- Id of your controlled turtle
  6. -- End of settings --
  7.  
  8. rednet.open(mside)
  9. function o()
  10. os.reboot()
  11. end
  12.  
  13. function start2()
  14. term.clear()
  15. sleep(1)
  16. term.setCursorPos(1,1)
  17. print("[1] Make turtle go forward")
  18. term.setCursorPos(1,2)
  19. print("[2] Make turtle go backwards")
  20. term.setCursorPos(1,3)
  21. print("[3] Make turtle turn left")
  22. term.setCursorPos(1,4)
  23. print("[4] Make turtle turn right")
  24. term.setCursorPos(1,5)
  25. print("[5] Make turtle go up")
  26. term.setCursorPos(1,6)
  27. print("[6] Make turtle go down")
  28. term.setCursorPos(1,7)
  29. print("[7] Make turtle dig (Only mining turtles)")
  30. term.setCursorPos(1,8)
  31. print("[8] Exit to start")
  32. term.setCursorPos(1,9)
  33. write("Input number please: ")
  34. local input = read()
  35. if input == "1" then
  36. rednet.send(turtleid, "forward")
  37. start2()
  38. elseif input == "2" then
  39. rednet.send(turtleid, "backwards")
  40. start2()
  41. elseif input == "3" then
  42. rednet.send(turtleid, "left")
  43. start2()
  44. elseif input == "4" then
  45. rednet.send(turtleid, "right")
  46. start2()
  47. elseif input == "5" then
  48. rednet.send(turtleid, "up")
  49. start2()
  50. elseif input == "6" then
  51. rednet.send(turtleid, "down")
  52. start2()
  53. elseif input == "7" then
  54. rednet.send(turtleid, "dig")
  55. start2()
  56. end
  57. end
  58.  
  59. function start()
  60. term.clear()
  61. term.setTextColor(textcolor)
  62. term.setBackgroundColor(bgcolor)
  63. term.setCursorPos(1,1)
  64. term.setBackgroundColor(bgcolor)
  65. print("Running Mackan90096's Turtle Controlling program version 1.0")
  66. term.setCursorPos(1,2)
  67. term.setBackgroundColor(bgcolor)
  68. term.setCursorPos(1,3)
  69. term.setBackgroundColor(bgcolor)
  70. term.setCursorPos(1,4)
  71. term.setBackgroundColor(bgcolor)
  72. term.setCursorPos(1,6)
  73. term.setBackgroundColor(bgcolor)
  74. term.setCursorPos(1,7)
  75. term.setBackgroundColor(bgcolor)
  76. term.setCursorPos(1,8)
  77. term.setBackgroundColor(bgcolor)
  78. term.setCursorPos(1,9)
  79. term.setBackgroundColor(bgcolor)
  80. term.setCursorPos(1,10)
  81. term.setBackgroundColor(bgcolor)
  82. term.setCursorPos(1,11)
  83. term.setBackgroundColor(bgcolor)
  84. term.setCursorPos(1,12)
  85. term.setBackgroundColor(bgcolor)
  86. term.setCursorPos(1,13)
  87. term.setBackgroundColor(bgcolor)
  88. term.setCursorPos(1,14)
  89. term.setBackgroundColor(bgcolor)
  90. term.setCursorPos(1,15)
  91. term.setBackgroundColor(bgcolor)
  92.  
  93. term.setCursorPos(5,5)
  94. term.setBackgroundColor(bgcolor)
  95. print("Start? Y/N")
  96. local input = read()
  97. if input == "y" then
  98. start2()
  99. elseif input == "n" then
  100. term.clear()
  101. end
  102. end
  103.  
  104.  
  105. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement