Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Monitor laden
- local monitor = peripheral.wrap("left")
- if not monitor then
- print("Kein Monitor gefunden.")
- return
- end
- -- Bildschirm vorbereiten
- monitor.setBackgroundColor(colors.black)
- monitor.setTextColor(colors.white)
- monitor.clear()
- monitor.setCursorPos(1, 1)
- -- Dateiname abfragen
- term.setTextColor(colors.lightBlue)
- io.write("Name des gespeicherten Screens: ")
- local name = read()
- local path = "screens/" .. name
- if not fs.exists(path) then
- term.setTextColor(colors.red)
- print("Datei nicht gefunden: " .. path)
- return
- end
- -- Datei einlesen
- local file = fs.open(path, "r")
- local lines = {}
- while true do
- local line = file.readLine()
- if not line then break end
- table.insert(lines, line)
- end
- file.close()
- -- Einträge anzeigen
- for _, entry in ipairs(lines) do
- local gap, line, textColor, bgColor, text = entry:match("([^,]+),([^,]+),([^,]+),([^,]+),(.+)")
- gap = tonumber(gap)
- line = tonumber(line)
- textColor = tonumber(textColor)
- bgColor = tonumber(bgColor)
- if gap and line and textColor and bgColor and text then
- monitor.setCursorPos(gap, line)
- monitor.setTextColor(textColor)
- monitor.setBackgroundColor(bgColor)
- monitor.write(text)
- end
- end
- term.setTextColor(colors.green)
- print("Bildschirm geladen und angezeigt.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement