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("FEC3E5EA47C6B134A9613FB0CC51CCD3")
- Tank1 = component.proxy("E19432AE46CCC08F1A5D09969E33CF85")
- Tank2 = component.proxy("98A62C4B4C2233627321D1B30816F8E5")
- gpu1:bindScreen(Screen)
- gpu1:setsize(100,20)
- gpu1:setForeground(1,1,1,1)
- gpu1:setBackground(0,0,0,0)
- -- event.listen(gpu1)
- -- Bezeichnungen --
- line="--------------------------"
- -- OPTION --
- Tank1:flush()
- Tank2:flush()
- -- DATEN --
- z = 0
- o = 5 -- oberes ende
- u = o+13 -- unteres ende
- function getdata()
- V1 = Tank1.fluidcontent
- F1 = Tank1.flowfill*60 - Tank1.flowdrain*60
- V1 = math.floor(V1) -- runden --
- F1 = math.floor(F1) -- runden --
- V2 = Tank2.fluidcontent
- F2 = Tank2.flowfill*60 - Tank2.flowdrain*60
- V2 = math.floor(V2) -- runden --
- F2 = math.floor(F2) -- runden --
- end
- -- AUSGABE --
- function stream()
- gpu1:fill(0,0,100,20," ")
- gpu1:setText(0,z,"Tank 1: "..V1.."L") -- Tank1
- gpu1:setText(15,z,"|".."\tNET: "..F1)
- gpu1:setText(0,z+1,line) -- Trennlinie
- gpu1:setText(0,z+2,"Tank 2: "..V2.."L") -- Tank2
- gpu1:setText(15,z+2,"|".."\tNET: "..F2)
- gpu1:setText(0,z+3,line) -- Trennlinie
- h = {}
- p = {}
- hx = 1 -- Start h = 1
- hz = 3 -- Anzahl der Tanks
- for i = 1, hz, 1 do
- h[hx] = math.random(2400)
- p[hx] = math.floor((100/2400)*h[hx]/10)
- -- print (h[hx], p[hx])
- hx = hx + 1
- end
- x = 29 -- x Spalte für Anzeigen
- 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
- -- Tank 1 --
- hx = 1
- Z = h[hx]
- Zahlenformat()
- gpu1:setBackground(0,0,255,1)
- gpu1:fill(x+1,u-p[hx],2,p[hx]," ")
- 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,"----")
- -- Tank 2 --
- x = x + 6
- hx = hx +1
- Z = h[hx]
- Zahlenformat()
- gpu1:setBackground(0,0,255,1)
- gpu1:fill(x+1,u-p[hx],2,p[hx]," ")
- 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,"----")
- -- Tank 3 --
- x = x + 6
- hx = hx +1
- Z = h[hx]
- Zahlenformat()
- gpu1:setBackground(0,0,255,1)
- gpu1:fill(x+1,u-p[hx],2,p[hx]," ")
- 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:flush()
- end
- function Balken()
- end
- -- RUN --
- while true do
- event.pull(2)
- getdata()
- -- print(V1,"\t",V2)
- stream()
- Z = ""
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement