davedumas0

Untitled

Feb 14th, 2023
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. function modemListen()
  2. local messageHandlers = {
  3. LFT = executeTurnLeft,
  4. RHT = executeTurnRight,
  5. FWD = executeForward,
  6. BWD = executeBack,
  7. UP = executeUp,
  8. DWN = executeDown,
  9. DCT_UPW = executeDetctUpward,
  10. DCT_DWD = executeDetctDownward,
  11. DCT_FWD = executeDetctForward,
  12. USE_FWD = executeUseForward,
  13. CHK_SL1 = getInventoryInfo_SLOT1,
  14. }
  15.  
  16. modem.open(5)
  17. executed = false
  18. _, _, from, port, _, msg = event.pull(0.05, "modem_message")
  19. if msg ~= nil then
  20. message = msg
  21. if message == "LFT" and not executed then
  22. executeTurnLeft()
  23. message = " "
  24. end
  25. if message == "RHT" and not executed then
  26. executeTurnRight()
  27. message = " "
  28. end
  29. if message == "FWD" and not executed then
  30. executeForward()
  31. message = " "
  32. end
  33. if message == "BWD" and not executed then
  34. executeBack()
  35. message = " "
  36. end
  37. if message == "UP" and not executed then
  38. executeUp()
  39. message = " "
  40. end
  41. if message == "DWN" and not executed then
  42. executeDown()
  43. message = " "
  44. end
  45. if message == "DCT_UPW" and not executed then
  46. executeDetctUpward()
  47. message = " "
  48. end
  49. if message == "DCT_DWD" and not executed then
  50. executeDetctDownward()
  51. message = " "
  52. end
  53. if message == "DCT_FWD" and not executed then
  54. executeDetctForward()
  55. message = " "
  56. end
  57. if message == "USE_FWD" and not executed then
  58. executeUseForward()
  59. message = " "
  60. end
  61. if message == "CHK_SL1" and not executed then
  62. getInventoryInfo_SLOT1()
  63. message = " "
  64. end
  65. else
  66. message = " "
  67. end
  68. os.sleep(0.0)
  69. end
  70.  
Add Comment
Please, Sign In to add comment