Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Komponenten --
- event.ignoreAll()
- gpu1 = computer.getGPUs(1)[1]
- Screen = component.proxy("EB28F3074BF408838BFFB8A3BA1DFBBF")
- Tank1 = component.proxy("5CAD58D14B6957B972D744B8D6C00249")
- Tank2 = component.proxy("E167C9E446DA5A4AF905FC9441B3F1EE")
- Tank3 = component.proxy("0A30AD024F4B6B469B54418D6E2F8FBE")
- Tank4 = component.proxy("805A760B42CCE1280219CE9CC46E0D61")
- Tank5 = component.proxy("11426AC7442ABA62416712BDD79F1442")
- Tank6 = component.proxy("D94F64124083F9AE721D7083DBE5B114")
- Tank7 = component.proxy("86AA298C48133B4C1A5172956BF844AF")
- Tank8 = component.proxy("A404B0F84AF67465E32051A66A8E8167")
- Tank9 = component.proxy("559CA354435F22050D4EEE814031B0E0")
- Tank10 = component.proxy("4345A1284B70EF76CC2536B66F446842")
- Tank11 = component.proxy("C4A2AF664F364A5E0118DD8A53261AEF")
- Tank12 = component.proxy("6AF4545246BF7F732D7CE4A4138071D5")
- Tank13 = component.proxy("D0F9CCA940A59D2C962CC08AFCAB0DC7")
- Tank14 = component.proxy("959F16184C2943AA51BF05920CDBFD52")
- Tank15 = component.proxy("0C11AE424FB1CC68CB5FA49CE1772DCE")
- Tank16 = component.proxy("E0F2DBBC4D878585A89F409AD2F905CA")
- Tank17 = component.proxy("595AD2834AD043B58F6740A362F1A26B")
- 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 = 17 -- 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, Tank14.fluidcontent, Tank15.fluidcontent, Tank16.fluidcontent, Tank17.fluidcontent}
- xv = 1 -- Datensatz Start 1
- T = 17 -- 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
Add Comment
Please, Sign In to add comment