Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Variablen
- protokoll = "1594"
- light = "bottom"
- modul = "back"
- -- Start
- rednet.open(modul)
- redstone.setOutput(light, true)
- mon = peripheral.wrap("right")
- print("Keine Nachricht empfangen")
- print("Warte auf erste Nachricht")
- -- Funktionen
- function blink()
- for i = 1, 5 do
- redstone.setOutput(light, false)
- sleep(0.2)
- redstone.setOutput(light, true)
- sleep(0.2)
- end
- end
- function newLine()
- local cX,cY= mon.getCursorPos()
- mon.setCursorPos(1,cY+1)
- end
- function dashboard(memo)
- mon.clear()
- mon.setCursorPos(1,1)
- mon.write("Neuste Nachricht: ")
- local cX = mon.getCursorPos()
- zeilen = math.ceil(string.len(memo)/cX)
- for i = 1, zeilen do
- newLine()
- mon.write(string.sub(memo, (i-1)*cX+1, i*cX))
- end
- end
- -- Loader
- while true do
- local senderId, message = rednet.receive()
- shell.run("clear")
- if string.sub(message, 0, string.len(protokoll)) == protokoll then
- blink()
- print("Blink abgeschlossen")
- dashboard(string.sub(message, string.len(protokoll) +1))
- print("Dashboard abgeschlossen")
- else
- print("Falsches Protokoll")
- print("Protokoll: " .. string.sub(message, 0, string.len(protokoll)))
- end
- print("Warte auf neue Nachricht")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement