Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. tid = 379
  2. thing = "none"
  3. rednet.open("right")
  4. other = "none"
  5. function s()
  6. sleep(.4)
  7. end
  8.  
  9. while true do
  10. if other == "yes" then
  11. term.clear()
  12. term.setCursorPos(1,1)
  13. print("Blood-Corp Turtle Systems")
  14. print("Please enter control type (command or key) : ")
  15. local test = read()
  16. if test == "command" then
  17. thing = "command"
  18. elseif test == "key" then
  19. thing = "key"
  20. end
  21. end
  22. if thing == "command" then
  23. command = true
  24. while command == true do
  25. term.clear()
  26. term.setCursorPos(1,1)
  27. print("Blood-Corp Turtle Systems")
  28. print("Commands : up,down,left,right,forward,back,exit.")
  29. term.setCursorPos(1,3)
  30. write("Enter Command : ")
  31. local command = read()
  32. if command == "forward" then
  33. rednet.send(tid, "forward")
  34. print("Sent Forward")
  35. s()
  36. elseif command == "left" then
  37. rednet.send(tid, "right")
  38. print("Sent Left")
  39. s()
  40. elseif command == "right" then
  41. rednet.send(tid, "left")
  42. print("Sent Right")
  43. s()
  44. elseif command == "back" then
  45. rednet.send(tid, "back")
  46. print("Sent Back")
  47. s()
  48. elseif command == "up" then
  49. rednet.send(tid, "up")
  50. print("Sent Up")
  51. s()
  52. elseif command == "down" then
  53. rednet.send(tid, "down")
  54. print("Sent Down")
  55. s()
  56. elseif command == "exit" then
  57. command = false
  58. other = "yes"
  59. s()
  60. else
  61. print("Unknown Command.")
  62. print("Usage: up,down,left,right,forward,back,exit.")
  63. sleep(1)
  64. end
  65. end
  66. elseif thing == "key" then
  67. term.clear()
  68. term.setCursorPos(1,1)
  69. print("Blood-Corp Turtle Systems")
  70. print("Keys : ](up), [(down), a(right), d(left).\nKeys : w(forward), s(back), z(exit).")
  71. key = true
  72. while key == true do
  73. local evt, c = os.pullEvent("char")
  74. c = string.lower(c)
  75. if c == "w" then
  76. rednet.send(tid, "forward")
  77. print("Sent Forward")
  78. elseif c == "d" then
  79. rednet.send(tid, "right")
  80. print("Sent Left")
  81. elseif c == "a" then
  82. rednet.send(tid, "left")
  83. print("Sent Right")
  84. elseif c == "s" then
  85. rednet.send(tid, "back")
  86. print("Sent Back")
  87. elseif c == "]" then
  88. rednet.send(tid, "up")
  89. print("Sent Up")
  90. elseif c == "[" then
  91. rednet.send(tid, "down")
  92. print("Sent Down")
  93. elseif c == "z" then
  94. key = false
  95. other = "yes"
  96. s()
  97. else
  98. print("Unknown Key.")
  99. print("Usage : ](up), [(down), a(right), d(left).\nUsage : w(forward), s(back), z(exit).")
  100. sleep(1)
  101. end
  102. end
  103. end
  104. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement