jordyvl

Turtle control client

Jun 1st, 2013
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.02 KB | None | 0 0
  1. term.setBackgroundColor(colors.cyan)
  2. print("  ")
  3. term.clear()
  4. term.setCursorPos(1,1)
  5. print("Please Enter Side Modem Is On")
  6. input = read()
  7. rednet.open(input)
  8. term.setBackgroundColor(colors.lime)
  9. print(" ")
  10. term.clear()
  11. term.setCursorPos(18, 10)
  12. print("Rednet Is Open")
  13. sleep(2)
  14. term.setBackgroundColor(colors.cyan)
  15. print(" ")
  16. term.clear()
  17. term.setCursorPos(1, 1)
  18. print("Please Enter Turtle ID")
  19. input = tonumber(read())
  20. term.setBackgroundColor(colors.lime)
  21. print(" ")
  22. term.clear()
  23. term.setCursorPos(20, 10)
  24. print("ID Accepted")
  25. sleep(2)
  26. term.setBackgroundColor(colors.cyan)
  27. print(" ")
  28. term.clear()
  29. term.setCursorPos(1, 1)
  30. term.setTextColor(colors.white)
  31. print("Controls:")
  32. print("Arrowkey Up = Forward")
  33. print("Arrowkey Down = Back")
  34. print("Arrowkey Left = Left")
  35. print("Arrowkey Right = Right")
  36. print("Numpad 0 = Place")
  37. print("Numpad 2 = Up")
  38. print("Numpad 4 = Redstone Activation")
  39. print("Enter = Refuel")
  40. print("Numpad 1 = Dig")
  41. print("Numpad 5 = Dig Up")
  42. print("Numpad 6 = Dig Down")
  43. print("Numpad 7 = Place Up")
  44. print("Numpad 8 = Place Down")
  45. print("R Shift = Restart")
  46. print("+ = Quit")
  47. print(". Decimal = Show Controls")
  48. print("Reminder If You Haven't Put Coal In The Turtle It Won't Move So Please Do.")
  49. while true do
  50. event, e = os.pullEvent("key")
  51. if e == 200 then
  52.   rednet.send(input,"forward")
  53.   print("Moving Forward")
  54. elseif e == 208 then
  55.   rednet.send(input,"back")
  56.   print("Moving Backwards")
  57. elseif e == 203 then
  58.   rednet.send(input,"left")
  59.   print("Turning Left")
  60. elseif e == 205 then
  61.   rednet.send(input,"right")
  62.   print("Turning Right")
  63. elseif e == 82 then
  64.   rednet.send(input,"place")
  65.   print("Placing")
  66. elseif e == 79 then
  67.   rednet.send(input,"dig")
  68.   print("Digging")
  69. elseif e == 80 then
  70.   rednet.send(input,"up")
  71.   print("Going Up")
  72. elseif e == 81 then
  73.   rednet.send(input,"down")
  74.   print("Going Down")
  75. elseif e == 75 then
  76.   rednet.send(input,"redstone")
  77.   print("Redstone Switching On")
  78.   sleep(1.5)
  79.   print("Redstone Switching Off")
  80. elseif e == 28 then
  81.   rednet.send(input,"refuel")
  82.   print("Refueling")
  83. elseif e == 54 then
  84.   shell.run("turtlespy")
  85. elseif e == 83 then
  86.   term.clear()
  87.   term.setCursorPos(1, 1)
  88.   print("Controls:")
  89.   print("Arrowkey Up = Forward")
  90.   print("Arrowkey Down = Back")
  91.   print("Arrowkey Left = Left")
  92.   print("Arrowkey Right = Right")
  93.   print("Numpad 0 = Place")
  94.   print("Numpad 2 = Up")
  95.   print("Numpad 4 = Redstone Activation")
  96.   print("Enter = Refuel")
  97.   print("Numpad 1 = Dig")
  98.   print("Numpad 5 = Dig Up")
  99.   print("Numpad 6 = Dig Down")
  100.   print("Numpad 7 = Place Up")
  101.   print("Numpad 8 = Place Down")
  102.   print("R Shift = Restart")
  103.   print("+ = Quit")
  104.   print(". Decimal = Show Controls")
  105. elseif e == 78 then
  106.   break
  107. elseif e == 76 then
  108.   rednet.send(input,"digup")
  109.   print("Digging Up")
  110. elseif e == 77 then
  111.   rednet.send(input,"digdown")
  112.   print("Digging Down")
  113. elseif e == 71 then
  114.   rednet.send(input,"placeup")
  115.   print("Placing Up")
  116. elseif e == 72 then
  117.   rednet.send(input,"placedown")
  118.   print("Placing Down")
  119. end
  120. end
Add Comment
Please, Sign In to add comment