On_The_Edge

Vertikale Füllstandsanzeige

Feb 23rd, 2021 (edited)
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.70 KB | None | 0 0
  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)
  13.  
  14. -- Bezeichnungen --
  15. line="--------------------------"
  16.  
  17.  
  18. -- OPTION --
  19. Tank1:flush()
  20. Tank2:flush()
  21.  
  22. -- DATEN --
  23. z = 0
  24. o = 5 -- oberes ende
  25. u = o+13 -- unteres ende
  26.  
  27. function getdata()
  28. V1 = Tank1.fluidcontent
  29. F1 = Tank1.flowfill*60 - Tank1.flowdrain*60
  30.  
  31. V1 = math.floor(V1) -- runden --
  32. F1 = math.floor(F1) -- runden --
  33.  
  34. V2 = Tank2.fluidcontent
  35. F2 = Tank2.flowfill*60 - Tank2.flowdrain*60
  36.  
  37. V2 = math.floor(V2) -- runden --
  38. F2 = math.floor(F2) -- runden --
  39. end
  40.  
  41. -- AUSGABE --
  42. function stream()
  43. gpu1:fill(0,0,100,20," ")
  44. gpu1:setText(0,z,"Tank 1: "..V1.."L")   -- Tank1
  45. gpu1:setText(15,z,"|".."\tNET: "..F1)
  46.  
  47. gpu1:setText(0,z+1,line)                -- Trennlinie
  48.  
  49. gpu1:setText(0,z+2,"Tank 2: "..V2.."L") -- Tank2
  50. gpu1:setText(15,z+2,"|".."\tNET: "..F2)
  51.  
  52. gpu1:setText(0,z+3,line)                -- Trennlinie
  53.  
  54. h = math.random(2400)
  55. -- h = 2400
  56. p = math.floor((100/2400)*h/10)
  57.  
  58. x = 29 -- x Spalte für Anzeigen
  59.  
  60. gpu1:setBackground(0,0,255,1)
  61.  
  62. gpu1:fill(x+1,u-p,2,p," ")
  63. gpu1:setBackground(0,0,0,0)
  64. gpu1:setText(x,u,"----")
  65. gpu1:fill(x,o+3,1,10,"|")
  66. gpu1:fill(x+3,o+3,1,10,"|")
  67. gpu1:setText(x,o+2,"----")
  68. gpu1:setText(x,o+1,h)
  69. gpu1:setText(x,o,"----")
  70.  
  71.  
  72.  
  73.  
  74.  
  75. gpu1:flush()
  76. end
  77.  
  78. function Balken()
  79.  
  80.  
  81. end
  82.  
  83.  
  84.  
  85. -- RUN --
  86.  
  87. while true do
  88. event.pull(2)
  89. getdata()
  90. -- print(V1,"\t",V2)
  91. stream()
  92.  
  93. end
Add Comment
Please, Sign In to add comment