drProfessorGTA

BSMA

Jun 1st, 2019
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.42 KB | None | 0 0
  1. rednet.open("right")
  2. mon = peripheral.wrap("left")
  3. laut = peripheral.wrap("top")
  4. druck = peripheral.wrap("bottom")
  5. rednet.send(6,"start")
  6. alarm = 0
  7. cursor = 1
  8. mel = 1
  9. mon.setTextScale(0.5)
  10. fs.makeDir("BSMA")
  11. while true do
  12. id,msg = rednet.receive(20)
  13. if alarm == 0 then
  14. rednet.send(6,"start")
  15. end
  16.  
  17. if id == 6 and msg == "quit" then
  18. if alarm == 0 then
  19. shell.run("quit")
  20. end
  21. end
  22.  
  23. if id == 11 and msg == "quit" then
  24. if alarm == 0 then
  25. shell.run("quit")
  26. end
  27. end
  28.  
  29. if id == 11 and msg == "Alarm" then
  30. ort = "Industriepark Witthoven"
  31. melderart = "Manuelle Übertragungseinrichtung"
  32. melderbesch = "Tablet"
  33. end
  34.  
  35. if id == 3 and msg ~= "alarm" then
  36. ort = "Verwaltung drP Service AG"
  37. if msg == "01/01" or msg == "01/02" then
  38. melderart = "Automatische Übertragungseinrichtung"
  39. melderbesch = "Flammenmelder"
  40. else
  41. melderart = "Manuelle Übertragungseinrichtung"
  42. melderbesch = "Handfeuermelder"
  43. end
  44. end
  45.  
  46. if id == 11 or id == 3 then
  47.  
  48. if msg == "alarm" then
  49. rednet.send(6,"alarm")
  50. rednet.send(9,"alarm")
  51. rednet.send(12,"alarm")
  52. rednet.send(13,"alarm")
  53. sleep(1.5)
  54. rednet.send(14,"alarm")
  55. sleep(1.5)
  56. rednet.send(15,"alarm")
  57. sleep(1.5)
  58. rednet.send(16,"alarm")
  59. alarm = 1
  60. local file = fs.open("BSMA/AktivAlarm","a")
  61. file.writeLine(id)
  62. elseif msg == "Alarm" then
  63. rednet.send(6,"alarm")
  64. rednet.send(9,"Aalarm")
  65. rednet.send(12,"Aalarm")
  66. rednet.send(13,"alarm")
  67. sleep(1.5)
  68. rednet.send(14,"alarm")
  69. sleep(1.5)
  70. rednet.send(15,"alarm")
  71. sleep(1.5)
  72. rednet.send(16,"alarm")
  73. end
  74. if msg ~= "alarm" or id == 11 then
  75. mon.setCursorPos(1,cursor)
  76. if msg ~= "alarm" and id ~= 11 then
  77. mon.write("BSMA | Aktiver BRANDMELDEALARM")
  78. elseif id == 11 then
  79. mon.write("BSMA | Aktiver ALARM")
  80. end
  81. cursor = cursor+1
  82. mon.setCursorPos(1,cursor)
  83. mon.write("---------------------------------------------------")
  84. cursor = cursor+1
  85. mon.setCursorPos(1,cursor)
  86. mon.write("Meldung ")
  87. mon.write(mel)
  88. mon.write(":")
  89. cursor = cursor+1
  90. mon.setCursorPos(1,cursor)
  91. mon.write("Gebäude: ")
  92. mon.write(ort)
  93. cursor = cursor+1
  94. mon.setCursorPos(1,cursor)
  95. mon.write("Melderart: ")
  96. mon.write(melderart)
  97. cursor = cursor+1
  98. mon.setCursorPos(1,cursor)
  99. mon.write("Melderbeschreibung: ")
  100. mon.write(melderbesch)
  101. cursor = cursor+1
  102. mon.setCursorPos(1,cursor)
  103. mon.write("Meldernummer: ")
  104. mon.write(msg)
  105. cursor = cursor+1
  106. mon.setCursorPos(1,cursor)
  107. mon.write("---------------------------------------------------")
  108. cursor = cursor+1
  109. mel = mel+1
  110. end
  111.  
  112. end
  113.  
  114. end
Advertisement
Add Comment
Please, Sign In to add comment