Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Dashboard
- wModul = "top" --Angabe für die Position des Wirless Modems
- monitor = "right" --Angabe für die Position des Monitors
- TextScale = 1 --Anagbe für die Größe der Schrift
- PInfo = "1900Info" --Angabe für das Sende Protokoll Info --Müssen im Code gewechselt werden
- PWarn = "1900Warn" --Angabe für das Sende Protokoll Warn --Müssen im Code gewechselt werden
- PCrit = "1900Crit" --Angabe für das Sende Protokoll Crit --Müssen im Code gewechselt werden
- url = "http://thecoin.de/time.php" --Woher soll der Computer die Uhrzeit nehmen
- --Code
- rednet.open(wModul)
- local monitor = peripheral.wrap(monitor)
- monitor.setTextScale(TextScale)
- monitor.setCursorPos(0,0)
- monitor.clear()
- maxX, maxY = monitor.getSize()
- lastRoundLocked = false
- print("Lade Daten...")
- rednet.broadcast("status?", "1900Player")
- senderId, message, protocol = rednet.receive("1900Player",10)
- if message == "Online" then
- POnline = true
- elseif message == "Offline" then
- POnline = false
- else
- print("Es scheint etwas nicht zu stimmen ?!")
- sleep(5)
- os.reboot()
- end
- shell.run("clear")
- print("Privates Dashboard")
- print("Max X: " .. maxX)
- print("Max Y: " .. maxY)
- function info()
- senderId, message, protocol = rednet.receive("1900Info")
- show("Info", message)
- end
- function warn()
- senderId, message, protocol = rednet.receive("1900Warn")
- show("Warn", message)
- end
- function crit()
- senderId, message, protocol = rednet.receive("1900Crit")
- show("Crit", message)
- end
- function show(status, Message)
- x, y = monitor.getCursorPos()
- if message == "Benutzer ging Offline" then
- POnline = false;
- elseif message == "Benutzer ging Online" then
- POnline = true;
- end
- if POnline == true then
- curX, curY = monitor.getCursorPos()
- if (curY == math.floor((maxY/2) + 0,5) and lastRoundLocked == true) then
- monitor.clear()
- y = 0 --Fix für die Ansicht
- lastRoundLocked = false
- end
- if y == maxY then
- monitor.scroll(1)
- monitor.setCursorPos(1, maxY)
- else
- monitor.setCursorPos(1, y + 1)
- end
- monitor.write(http.get(url).readAll() .. ": " .. status .. ": " .. Message)
- else
- monitor.clear()
- monitor.setCursorPos(1, math.floor((maxY/2) + 0,5))
- monitor.write("Dashboard nicht aktiv!")
- lastRoundLocked = true
- end
- end
- while true do --Endlosschleife
- parallel.waitForAny(info, warn, crit)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement