SHOW:
|
|
- or go back to the newest paste.
1 | -- Komponenten -- | |
2 | event.ignoreAll() | |
3 | gpu1 = computer.getGPUs(1)[1] | |
4 | Screen = component.proxy("FEC3E5EA47C6B134A9613FB0CC51CCD3") | |
5 | Tank1 = component.proxy("E19432AE46CCC08F1A5D09969E33CF85") | |
6 | Tank2 = component.proxy("98A62C4B4C2233627321D1B30816F8E5") | |
7 | ||
8 | gpu1:bindScreen(Screen) | |
9 | gpu1:setsize(100,20) | |
10 | gpu1:setForeground(1,1,1,1) | |
11 | gpu1:setBackground(0,0,0,0) | |
12 | - | -- event.listen(gpu1) |
12 | + | |
13 | -- OPTION -- | |
14 | - | -- Bezeichnungen -- |
14 | + | |
15 | - | line="--------------------------" |
15 | + | |
16 | ||
17 | -- DATEN -- | |
18 | z = 0 -- Zeilenreset | |
19 | o = 5 -- oberes ende | |
20 | u = o+13 -- unteres ende | |
21 | ||
22 | function getdata() | |
23 | - | z = 0 |
23 | + | |
24 | F1 = Tank1.flowfill*60 - Tank1.flowdrain*60 | |
25 | ||
26 | V1 = math.floor(V1) -- runden -- | |
27 | F1 = math.floor(F1) -- runden -- | |
28 | ||
29 | V2 = Tank2.fluidcontent | |
30 | F2 = Tank2.flowfill*60 - Tank2.flowdrain*60 | |
31 | ||
32 | V2 = math.floor(V2) -- runden -- | |
33 | F2 = math.floor(F2) -- runden -- | |
34 | end | |
35 | ||
36 | -- AUSGABE -- | |
37 | function stream() | |
38 | gpu1:fill(0,0,100,20," ") | |
39 | ||
40 | h = {} | |
41 | p = {} | |
42 | hx = 1 -- Start h = 1 | |
43 | hz = 3 -- Anzahl der Tanks | |
44 | - | gpu1:setText(0,z,"Tank 1: "..V1.."L") -- Tank1 |
44 | + | |
45 | - | gpu1:setText(15,z,"|".."\tNET: "..F1) |
45 | + | |
46 | p[hx] = math.floor((100/2400)*h[hx]/10) | |
47 | - | gpu1:setText(0,z+1,line) -- Trennlinie |
47 | + | |
48 | end | |
49 | - | gpu1:setText(0,z+2,"Tank 2: "..V2.."L") -- Tank2 |
49 | + | |
50 | - | gpu1:setText(15,z+2,"|".."\tNET: "..F2) |
50 | + | x = 5 -- x Spalte für Anzeigen vom linken Rand |
51 | ||
52 | - | gpu1:setText(0,z+3,line) -- Trennlinie |
52 | + | |
53 | if Z < 10 then Z = " "..h[hx] | |
54 | return Z | |
55 | end | |
56 | ||
57 | if Z < 100 then Z = " "..h[hx] | |
58 | return Z | |
59 | end | |
60 | ||
61 | - | -- print (h[hx], p[hx]) |
61 | + | |
62 | return Z | |
63 | end | |
64 | end | |
65 | - | x = 29 -- x Spalte für Anzeigen |
65 | + | |
66 | -- Tank 1 -- | |
67 | hx = 1 | |
68 | Z = h[hx] | |
69 | Zahlenformat() | |
70 | ||
71 | gpu1:setBackground(0,0,255,1) | |
72 | gpu1:fill(x+1,u-p[hx],2,p[hx]," ") | |
73 | gpu1:setBackground(0,0,0,0) | |
74 | gpu1:setText(x,u,"----") | |
75 | gpu1:fill(x,o+3,1,10,"|") | |
76 | gpu1:fill(x+3,o+3,1,10,"|") | |
77 | gpu1:setText(x,o+2,"----") | |
78 | gpu1:setText(x,o+1,Z) | |
79 | gpu1:setText(x,o,"----") | |
80 | ||
81 | -- Tank 2 -- | |
82 | x = x + 7 -- Abstand der Anzeigen zueinander | |
83 | hx = hx +1 | |
84 | Z = h[hx] | |
85 | Zahlenformat() | |
86 | ||
87 | gpu1:setBackground(0,0,255,1) | |
88 | gpu1:fill(x+1,u-p[hx],2,p[hx]," ") | |
89 | gpu1:setBackground(0,0,0,0) | |
90 | gpu1:setText(x,u,"----") | |
91 | gpu1:fill(x,o+3,1,10,"|") | |
92 | gpu1:fill(x+3,o+3,1,10,"|") | |
93 | gpu1:setText(x,o+2,"----") | |
94 | gpu1:setText(x,o+1,Z) | |
95 | gpu1:setText(x,o,"----") | |
96 | ||
97 | - | x = x + 6 |
97 | + | |
98 | x = x + 7 | |
99 | hx = hx +1 | |
100 | Z = h[hx] | |
101 | Zahlenformat() | |
102 | ||
103 | gpu1:setBackground(0,0,255,1) | |
104 | gpu1:fill(x+1,u-p[hx],2,p[hx]," ") | |
105 | gpu1:setBackground(0,0,0,0) | |
106 | gpu1:setText(x,u,"----") | |
107 | gpu1:fill(x,o+3,1,10,"|") | |
108 | gpu1:fill(x+3,o+3,1,10,"|") | |
109 | gpu1:setText(x,o+2,"----") | |
110 | gpu1:setText(x,o+1,Z) | |
111 | gpu1:setText(x,o,"----") | |
112 | ||
113 | - | x = x + 6 |
113 | + | |
114 | end | |
115 | ||
116 | -- RUN -- | |
117 | while true do | |
118 | event.pull(2) | |
119 | getdata() | |
120 | stream() | |
121 | Z = "" | |
122 | end |