Advertisement
MagmaLP

Test Mon 3

May 19th, 2025 (edited)
395
-1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Monitor laden
  2. local monitor = peripheral.wrap("left")
  3. if not monitor then
  4.   print("Kein Monitor gefunden.")
  5.   return
  6. end
  7.  
  8. -- Bildschirm vorbereiten
  9. monitor.setBackgroundColor(colors.black)
  10. monitor.setTextColor(colors.white)
  11. monitor.clear()
  12. monitor.setCursorPos(1, 1)
  13.  
  14. -- Dateiname abfragen
  15. term.setTextColor(colors.lightBlue)
  16. io.write("Name des gespeicherten Screens: ")
  17. local name = read()
  18.  
  19. local path = "screens/" .. name
  20. if not fs.exists(path) then
  21.   term.setTextColor(colors.red)
  22.   print("Datei nicht gefunden: " .. path)
  23.   return
  24. end
  25.  
  26. -- Datei einlesen
  27. local file = fs.open(path, "r")
  28. local lines = {}
  29. while true do
  30.   local line = file.readLine()
  31.   if not line then break end
  32.   table.insert(lines, line)
  33. end
  34. file.close()
  35.  
  36. -- Einträge anzeigen
  37. for _, entry in ipairs(lines) do
  38.   local gap, line, textColor, bgColor, text = entry:match("([^,]+),([^,]+),([^,]+),([^,]+),(.+)")
  39.   gap = tonumber(gap)
  40.   line = tonumber(line)
  41.   textColor = tonumber(textColor)
  42.   bgColor = tonumber(bgColor)
  43.  
  44.   if gap and line and textColor and bgColor and text then
  45.     monitor.setCursorPos(gap, line)
  46.     monitor.setTextColor(textColor)
  47.     monitor.setBackgroundColor(bgColor)
  48.     monitor.write(text)
  49.   end
  50. end
  51.  
  52. term.setTextColor(colors.green)
  53. print("Bildschirm geladen und angezeigt.")
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement