SHOW:
|
|
- or go back to the newest paste.
1 | -- Komponenten -- | |
2 | event.ignoreAll() | |
3 | gpu1 = computer.getGPUs(1)[1] | |
4 | - | Screen = component.proxy("7380B37A465C2D5B7C1E5FA98EADB15E") |
4 | + | Screen = component.proxy("EB28F3074BF408838BFFB8A3BA1DFBBF") |
5 | - | Tank1 = component.proxy("27982CDC4CD4B0C3C4B874A848A7A007") |
5 | + | Tank1 = component.proxy("5CAD58D14B6957B972D744B8D6C00249") |
6 | - | Tank2 = component.proxy("5A8736A345158E9700D710BDF83AB387") |
6 | + | Tank2 = component.proxy("E167C9E446DA5A4AF905FC9441B3F1EE") |
7 | - | Tank3 = component.proxy("6681E56349AD7FABB0E07B8A69148B2A") |
7 | + | Tank3 = component.proxy("0A30AD024F4B6B469B54418D6E2F8FBE") |
8 | - | Tank4 = component.proxy("7082385B48C55BF5B1E64E94D30BD8BF") |
8 | + | Tank4 = component.proxy("805A760B42CCE1280219CE9CC46E0D61") |
9 | - | Tank5 = component.proxy("F102D89B4394932DF65DA2BCA05323A5") |
9 | + | Tank5 = component.proxy("11426AC7442ABA62416712BDD79F1442") |
10 | - | Tank6 = component.proxy("5B8B130D496D10FF3B486596D99BF3DF") |
10 | + | Tank6 = component.proxy("D94F64124083F9AE721D7083DBE5B114") |
11 | - | Tank7 = component.proxy("6347B26B42EA2FBA38232BBB58B7EA30") |
11 | + | Tank7 = component.proxy("86AA298C48133B4C1A5172956BF844AF") |
12 | - | Tank8 = component.proxy("9BA0A46E414F3B1F722789898807FF32") |
12 | + | Tank8 = component.proxy("A404B0F84AF67465E32051A66A8E8167") |
13 | - | Tank9 = component.proxy("9CA14D0D412674B09226569E0864E5E1") |
13 | + | Tank9 = component.proxy("559CA354435F22050D4EEE814031B0E0") |
14 | - | Tank10 = component.proxy("EE90BD0248789F7897BD07BE730693A8") |
14 | + | |
15 | - | Tank11 = component.proxy("BA3F48844C6CCA90D53AF995FC630383") |
15 | + | Tank10 = component.proxy("4345A1284B70EF76CC2536B66F446842") |
16 | - | Tank12 = component.proxy("52C78C1D4D8657F2BD241C8F632C283E") |
16 | + | Tank11 = component.proxy("C4A2AF664F364A5E0118DD8A53261AEF") |
17 | - | Tank13 = component.proxy("117A436640B42B5BCEB4C9B8D067E1CA") |
17 | + | Tank12 = component.proxy("6AF4545246BF7F732D7CE4A4138071D5") |
18 | Tank13 = component.proxy("D0F9CCA940A59D2C962CC08AFCAB0DC7") | |
19 | Tank14 = component.proxy("959F16184C2943AA51BF05920CDBFD52") | |
20 | Tank15 = component.proxy("0C11AE424FB1CC68CB5FA49CE1772DCE") | |
21 | Tank16 = component.proxy("E0F2DBBC4D878585A89F409AD2F905CA") | |
22 | Tank17 = component.proxy("595AD2834AD043B58F6740A362F1A26B") | |
23 | ||
24 | ||
25 | gpu1:bindScreen(Screen) | |
26 | gpu1:setsize(100,20) | |
27 | gpu1:setForeground(1,1,1,1) | |
28 | gpu1:setBackground(0,0,0,0) | |
29 | ||
30 | -- OPTION -- | |
31 | -- Tank1:flush() | |
32 | -- Tank2:flush() | |
33 | - | T = 13 -- Anzahl der Tanks |
33 | + | |
34 | -- DATEN -- | |
35 | z = 0 -- Zeilenreset | |
36 | o = 5 -- oberes ende | |
37 | u = o+13 -- unteres ende | |
38 | T = 17 -- Anzahl der Tanks | |
39 | h = {} | |
40 | - | VS = {Tank1.fluidcontent, Tank2.fluidcontent, Tank3.fluidcontent, Tank4.fluidcontent, Tank5.fluidcontent, Tank6.fluidcontent, Tank7.fluidcontent, Tank8.fluidcontent, Tank9.fluidcontent, Tank10.fluidcontent, Tank11.fluidcontent, Tank12.fluidcontent, Tank13.fluidcontent} |
40 | + | |
41 | ||
42 | function getdata() | |
43 | - | T = 13 -- Anzahl der Tanks |
43 | + | |
44 | VS = {} | |
45 | VS = {Tank1.fluidcontent, Tank2.fluidcontent, Tank3.fluidcontent, Tank4.fluidcontent, Tank5.fluidcontent, Tank6.fluidcontent, Tank7.fluidcontent, Tank8.fluidcontent, Tank9.fluidcontent, Tank10.fluidcontent, Tank11.fluidcontent, Tank12.fluidcontent, Tank13.fluidcontent, Tank14.fluidcontent, Tank15.fluidcontent, Tank16.fluidcontent, Tank17.fluidcontent} | |
46 | ||
47 | xv = 1 -- Datensatz Start 1 | |
48 | T = 17 -- Anzahl der Tanks | |
49 | ||
50 | for i = 1,T,1 do -- Daten schreiben | |
51 | VS[xv] = math.floor(VS[xv]) -- runden -- | |
52 | if VS[xv] > 2400 then VS[xv] = 2400 | |
53 | end | |
54 | xv = xv +1 | |
55 | end | |
56 | ||
57 | hx = 1 -- Start h = 1 | |
58 | for i = 1,T,1 do -- Prozente für Balken ausrechnen | |
59 | h[hx] = VS[hx] | |
60 | p[hx] = math.floor((100/2400)*h[hx]/10) | |
61 | -- print ((h[hx]), (p[hx])) | |
62 | hx = hx + 1 | |
63 | end | |
64 | end | |
65 | ||
66 | -- AUSGABE -- | |
67 | function stream() | |
68 | gpu1:fill(0,0,100,20," ") | |
69 | ||
70 | x = 5 -- x Spalte für Anzeigen vom linken Rand | |
71 | ||
72 | -- Display Titel -- | |
73 | gpu1:setText(5,1,"S U P E R C O M P U T E R // F U E L T A N K S") | |
74 | gpu1:SetBackground(60,60,60,0.3) | |
75 | gpu1:fill(5,2,47,1," ") | |
76 | ||
77 | function Zahlenformat() -- Anzeige der Zahl je nach Länge der Zahl | |
78 | if Z < 10 then Z = " "..h[hx] | |
79 | return Z | |
80 | end | |
81 | ||
82 | if Z < 100 then Z = " "..h[hx] | |
83 | return Z | |
84 | end | |
85 | ||
86 | if Z < 1000 then Z = " "..h[hx] | |
87 | return Z | |
88 | end | |
89 | end | |
90 | ||
91 | -- Farbe der Balken festlegen -- | |
92 | function Balkenfarbe() | |
93 | if Z < 400 then gpu1:setBackground(255,0,0,1) | |
94 | end | |
95 | if Z >= 400 and Z < 2000 then gpu1:setBackground(255,165,0,1) | |
96 | end | |
97 | if Z >= 2000 then gpu1:setBackground(0,255,0,1) | |
98 | end | |
99 | end | |
100 | ||
101 | ||
102 | -- Tanks -- | |
103 | hx = 1 -- Datensatz 1 starten | |
104 | ||
105 | for i = 1,T,1 do | |
106 | Z = h[hx] | |
107 | Balkenfarbe() | |
108 | Zahlenformat() | |
109 | if VS[hx] < 240 then p[hx] = 1 | |
110 | end | |
111 | gpu1:fill(x+1,u-p[hx],2,p[hx]," ") -- Füllstand Balken zeichnen | |
112 | gpu1:setBackground(0,0,0,0) | |
113 | gpu1:setText(x,u,"----") | |
114 | gpu1:fill(x,o+3,1,10,"|") | |
115 | gpu1:fill(x+3,o+3,1,10,"|") | |
116 | gpu1:setText(x,o+2,"----") | |
117 | gpu1:setText(x,o+1,Z) | |
118 | gpu1:setText(x,o,"----") | |
119 | gpu1:setText(x,o-1," T"..hx) | |
120 | ||
121 | x = x + 7 -- Abstand der Anzeigen zueinander | |
122 | hx = hx +1 | |
123 | end | |
124 | ||
125 | ||
126 | gpu1:flush() | |
127 | end | |
128 | ||
129 | -- RUN -- | |
130 | while true do | |
131 | event.pull(2) | |
132 | getdata() | |
133 | stream() | |
134 | hx = 1 | |
135 | Z = "" | |
136 | end |