drProfessorGTA

Melder

Jun 2nd, 2019
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.32 KB | None | 0 0
  1. os.pullEvent = os.pullEventRaw
  2. rednet.open("bottom")
  3. laut = peripheral.wrap("right")
  4. mon = peripheral.wrap("left")
  5. alarm = 0
  6. sound = 1
  7. sts = 0
  8. while true do
  9. if alarm == 0 then
  10.     id,msg = rednet.receive()
  11. else
  12.     id,msg = rednet.receive(5)
  13. end
  14.  
  15. if id == nil then
  16. id = 4
  17. end
  18.  
  19. if id == 4 or id == 6 or id == 11 then
  20.  
  21. if msg == "quit" then
  22. mon.clear()
  23. os.reboot()
  24. end
  25.  
  26. if msg == "aquit" then
  27. sound = 0
  28. end
  29.  
  30. if msg == "alarm" or msg == "Aalarm" or alarm == 1 or msg == "Astörung" then
  31. if alarm == 0 then
  32. mon.setCursorPos(1,1)
  33. if msg == "alarm" then
  34. mon.write("Aktiver Brandmeldealarm")
  35. elseif msg == "Aalarm" then
  36. mon.write("Aktiver Alarm")
  37. elseif msg == "Astörung" then
  38. mon.write("BSMA STÖRUNG")
  39. sts = 1
  40. end
  41. end
  42. alarm = 1
  43. if sts == 0 then
  44. schleife = 40
  45. elseif sts == 1 then
  46. schleife = 20
  47. end
  48. while (schleife > 1) do
  49. rs.setOutput("top",true)
  50. if sound == 1 then
  51. if sts == 0 then
  52. laut.playNote("pling",15,5)
  53. elseif sts == 1 then
  54. laut.playNote("harp",15,10)
  55. end
  56. end
  57. if sts == 0 then
  58. sleep(0.25)
  59. elseif sts == 1 then
  60. sleep(1)
  61. end
  62. rs.setOutput("top",false)
  63. if sound == 1 then
  64. if sts == 0 then
  65. laut.playNote("pling",15,5)
  66. elseif sts == 1 then
  67. laut.playNote("harp",15,10)
  68. end
  69. end
  70. if sts == 0 then
  71. sleep(0.25)
  72. elseif sts == 1 then
  73. sleep(1)
  74. end
  75. schleife = schleife-1
  76. end
  77. end
  78.  
  79. end
  80. end
Advertisement
Add Comment
Please, Sign In to add comment