Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2020
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. -- Base Control System --
  2.  
  3. function lighting_control(cmd)
  4. if cmd == "on" then
  5. rednet.send(92,"command_lights_on")
  6. test,id,message = os.pullEvent("rednet_message")
  7. if message == "status_92_lights_on" then
  8. return "status_lights_already_on"
  9. elseif message == "status_92_lights_turned_on" then
  10. return "status_lights_turned_on"
  11. else
  12. return "status_error"
  13. end
  14. elseif cmd == "off" then
  15. rednet.send(92,"command_lights_off")
  16. test,id,message = os.pullEvent("rednet_message")
  17. if message == "status_92_lights_off" then
  18. return "status_lights_already_off"
  19. elseif message == "status_92_lights_turned_off" then
  20. return "status_lights_turned_off"
  21. else
  22. return "status_error"
  23. end
  24. elseif cmd == "check" then
  25. rednet.send(92,"command_lights_check")
  26. test,id,message = os.pullEvent("rednet_message")
  27. if message == "status_92_lights_on" then
  28. return "status_lights_on"
  29. elseif message == "status_92_lights_off" then
  30. return "status_lights_off"
  31. end
  32. end
  33. end
  34.  
  35.  
  36. function basiccontrol_beta(command)
  37. if command == "on" then
  38. temp = lighting_control("on")
  39. if temp == "status_lights_already_on" then
  40. message = "Lights Already On"
  41. elseif temp == "status_lights_turned_on" then
  42. message = "Lights Turned On"
  43. end
  44. elseif command == "off" then
  45. temp = lighting_control("off")
  46. if temp == "status_lights_already_off" then
  47. message = "Lights Already Off"
  48. elseif temp == "status_lights_turned_off" then
  49. message = "Lights Turned Off"
  50. end
  51. end
  52. end
  53.  
  54.  
  55.  
  56.  
  57. args = {...}
  58. command = args[1]
  59. basiccontrol_beta(command)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement