Advertisement
Skillkiller

Spezial Protokoll

Feb 10th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.33 KB | None | 0 0
  1. -- Variablen
  2. -- Protokolle
  3. CodeSend = "1594"
  4. CodeSpez = "1595"
  5.  
  6. -- Start
  7. shell.run("clear")
  8. rednet.open("top")
  9. print("Warte auf Special Protokolle")
  10.  
  11. -- Funkktionen
  12. function alarm()
  13. redstone.setOutput("right", true)
  14. sleep(7)
  15. redstone.setOutput("right", false)
  16. end
  17.  
  18. function dashboard(id,aktion,protokoll,nachricht)
  19. shell.run("clear")
  20. print("Special Protokoll Zentrale")
  21. -- print("Neue Nachicht von: " .. id)
  22. print("Protokoll: " .. protokoll)
  23. print("Nachricht: " .. nachricht)
  24. print("Aktion: " .. aktion)
  25. end
  26.  
  27. -- Loader
  28. while true do
  29.  local senderId, message = rednet.receive()
  30.  local protokoll = string.sub(message, 0, string.len(CodeSpez))
  31.  local nachricht = string.sub(message, string.len(CodeSpez) + 1)
  32.  if string.sub(message, 0, string.len(CodeSpez)) == CodeSpez then
  33.   if string.sub(message, string.len(CodeSpez) + 1) == "alarm" then
  34.    dashboard(senderId, "Starte 7 Sekunden Alarm", protokoll, nachricht)
  35.    alarm()
  36.    print("Aktion: Alarm gestoppt")
  37.   elseif string.sub(message, string.len(CodeSpez) + 1) == "alarmstart" then
  38.    dashboard(senderId, "Starte Alarm", protokoll, nachricht)
  39.    redstone.setOutput("right", true)
  40.   elseif string.sub(message, string.len(CodeSpez) + 1) == "alarmstop" then
  41.    dashboard(senderId, "Stoppe Alarm", protokoll, nachricht)
  42.    redstone.setOutput("right", false)
  43.   end
  44.  end
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement