Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Komponenten --
- event.ignoreAll()
- gpu1 = computer.getGPUs(1)[1]
- Screen = component.proxy("7380B37A465C2D5B7C1E5FA98EADB15E")
- Tank1 = component.proxy("27982CDC4CD4B0C3C4B874A848A7A007")
- Tank2 = component.proxy("5A8736A345158E9700D710BDF83AB387")
- Tank3 = component.proxy("6681E56349AD7FABB0E07B8A69148B2A")
- Tank4 = component.proxy("7082385B48C55BF5B1E64E94D30BD8BF")
- Tank5 = component.proxy("F102D89B4394932DF65DA2BCA05323A5")
- Tank6 = component.proxy("5B8B130D496D10FF3B486596D99BF3DF")
- Tank7 = component.proxy("6347B26B42EA2FBA38232BBB58B7EA30")
- Tank8 = component.proxy("9BA0A46E414F3B1F722789898807FF32")
- Tank9 = component.proxy("9CA14D0D412674B09226569E0864E5E1")
- Tank10 = component.proxy("EE90BD0248789F7897BD07BE730693A8")
- Tank11 = component.proxy("BA3F48844C6CCA90D53AF995FC630383")
- Tank12 = component.proxy("52C78C1D4D8657F2BD241C8F632C283E")
- Tank13 = component.proxy("117A436640B42B5BCEB4C9B8D067E1CA")
- gpu1:bindScreen(Screen)
- gpu1:setsize(100,20)
- gpu1:setForeground(1,1,1,1)
- gpu1:setBackground(0,0,0,0)
- -- OPTION --
- -- Tank1:flush()
- -- Tank2:flush()
- -- DATEN --
- z = 0 -- Zeilenreset
- o = 5 -- oberes ende
- u = o+13 -- unteres ende
- T = 13 -- Anzahl der Tanks
- h = {}
- p = {}
- function getdata()
- VS = {}
- 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}
- xv = 1 -- Datensatz Start 1
- T = 13 -- Anzahl der Tanks
- for i = 1,T,1 do -- Daten schreiben
- VS[xv] = math.floor(VS[xv]) -- runden --
- if VS[xv] > 2400 then VS[xv] = 2400
- end
- xv = xv +1
- end
- hx = 1 -- Start h = 1
- for i = 1,T,1 do -- Prozente für Balken ausrechnen
- h[hx] = VS[hx]
- p[hx] = math.floor((100/2400)*h[hx]/10)
- -- print ((h[hx]), (p[hx]))
- hx = hx + 1
- end
- end
- -- AUSGABE --
- function stream()
- gpu1:fill(0,0,100,20," ")
- x = 5 -- x Spalte für Anzeigen vom linken Rand
- -- Display Titel --
- 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")
- gpu1:SetBackground(60,60,60,0.3)
- gpu1:fill(5,2,47,1," ")
- function Zahlenformat() -- Anzeige der Zahl je nach Länge der Zahl
- if Z < 10 then Z = " "..h[hx]
- return Z
- end
- if Z < 100 then Z = " "..h[hx]
- return Z
- end
- if Z < 1000 then Z = " "..h[hx]
- return Z
- end
- end
- -- Farbe der Balken festlegen --
- function Balkenfarbe()
- if Z < 400 then gpu1:setBackground(255,0,0,1)
- end
- if Z >= 400 and Z < 2000 then gpu1:setBackground(255,165,0,1)
- end
- if Z >= 2000 then gpu1:setBackground(0,255,0,1)
- end
- end
- -- Tanks --
- hx = 1 -- Datensatz 1 starten
- for i = 1,T,1 do
- Z = h[hx]
- Balkenfarbe()
- Zahlenformat()
- if VS[hx] < 240 then p[hx] = 1
- end
- gpu1:fill(x+1,u-p[hx],2,p[hx]," ") -- Füllstand Balken zeichnen
- gpu1:setBackground(0,0,0,0)
- gpu1:setText(x,u,"----")
- gpu1:fill(x,o+3,1,10,"|")
- gpu1:fill(x+3,o+3,1,10,"|")
- gpu1:setText(x,o+2,"----")
- gpu1:setText(x,o+1,Z)
- gpu1:setText(x,o,"----")
- gpu1:setText(x,o-1," T"..hx)
- x = x + 7 -- Abstand der Anzeigen zueinander
- hx = hx +1
- end
- gpu1:flush()
- end
- -- RUN --
- while true do
- event.pull(2)
- getdata()
- stream()
- hx = 1
- Z = ""
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement