SHOW:
|
|
- or go back to the newest paste.
1 | - | 1,1,1,128,a |
1 | + | -- Monitor laden |
2 | - | 2,1,1,128,s |
2 | + | local monitor = peripheral.wrap("left") |
3 | - | 3,1,1,128,d |
3 | + | if not monitor then |
4 | - | 4,2,1,128,a |
4 | + | print("Kein Monitor gefunden.") |
5 | - | 5,2,1,128,s |
5 | + | return |
6 | - | 6,2,1,128,d |
6 | + | end |
7 | - | 7,3,1,128,a |
7 | + | |
8 | - | 8,3,1,128,s |
8 | + | -- Bildschirm vorbereiten |
9 | - | 9,3,1,128,d |
9 | + | monitor.setBackgroundColor(colors.black) |
10 | - | 10,4,1,128,a |
10 | + | monitor.setTextColor(colors.white) |
11 | - | 11,4,1,128,s |
11 | + | monitor.clear() |
12 | - | 12,4,1,128,d |
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 |