Advertisement
Skillkiller

Protokoll Zentrale

Feb 9th, 2016
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.37 KB | None | 0 0
  1. -- Variablen
  2. -- Protokolle
  3. CodeInfo = "1591"
  4. CodeWarn = "1592"
  5. CodeKrit = "1593"
  6. CodeSend = "1594"
  7.  
  8. -- Programm
  9. shell.run("clear")
  10. print("Protokoll Zentrale")
  11. print("Lade alle Funktionen")
  12. rednet.open("top")
  13. redstone.setOutput("left", true)
  14.  
  15. function dashboard(id, nachricht, status)
  16. shell.run("clear")
  17. print("Protokoll Zentrale")
  18. print()
  19. print("Nachricht erhalten von: " .. id)
  20. print("Nachricht: " .. nachricht)
  21. print("Status: " .. status)
  22. end
  23.  
  24. function alarm()
  25. redstone.setOutput("right", true)
  26. sleep(5)
  27. redstone.setOutput("right", false)
  28. end
  29.  
  30. while true do
  31. local senderId, message = rednet.receive()
  32. if string.sub(message, 0, string.len(CodeInfo)) == CodeInfo then
  33.  nachricht = string.sub(message, string.len(CodeInfo) + 1)
  34.  dashboard(senderId, string.sub(message, string.len(CodeInfo) + 1), "Information")
  35.  rednet.broadcast(CodeSend .. nachricht)
  36. elseif string.sub(message, 0, string.len(CodeWarn)) == CodeWarn then
  37.  nachricht = string.sub(message, string.len(CodeInfo) + 1)
  38.  dashboard(senderId, string.sub(message, string.len(CodeInfo) + 1), "Warnung")
  39.  rednet.broadcast(CodeSend .. nachricht)
  40. elseif string.sub(message, 0, string.len(CodeKrit)) == CodeKrit then
  41.  nachricht = string.sub(message, string.len(CodeInfo) + 1)
  42.  dashboard(senderId, string.sub(message, string.len(CodeInfo) + 1), "Kritisch")
  43.  rednet.broadcast(CodeSend .. nachricht)
  44. end
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement