pitrey

affichage base Kev 01/02/2023

Feb 1st, 2023
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. m = peripheral.wrap('top')
  2. m.setTextScale(1)
  3. m.setCursorPos(1,1)
  4. m.setBackgroundColor(colors.black)
  5. m.clear()
  6. --ColoneA = 2
  7. --ColoneB = 17
  8. Ligne = {3,7,11,15,19,23}
  9. EMC = 10
  10. RYG = {} -- table de couleur 1 - 100%
  11. --print("la base")
  12.  
  13. function def()
  14.     --print("def")
  15.     plage(RYG,1,20,colors.red)
  16.     plage(RYG,21,70,colors.yellow)
  17.     plage(RYG,71,100,colors,green)
  18.     RYG = {} --table de couleur 1 - 100%
  19.     Tab = {}
  20.     ta = {}
  21.     Box= {
  22.         A = {},
  23.         B = {}
  24.         }
  25. end
  26.  
  27. function
  28.    
  29.     for i = 1, 6 do
  30.         Box.A[i] = {X = 2, Y = Ligne[i]}
  31.         Box.B[i] = {X = 17, Y = Ligne[i]}
  32.     end
  33.        
  34.    
  35. end
  36.  
  37. function Box(box,color)
  38.     m.setBackgroundColor(color)
  39.     for i = box.X, box.X+11 do
  40.         for u = box.Y,box.Y+3 do
  41.         m.setCursorPos(i,u)
  42.         m.write(" ")
  43.         end
  44.     end
  45.     m.setBackgroundColor(colors.black)
  46.  
  47. end
  48.  
  49. function Table(ta,x,y,text,color_text,color_fond)
  50.     --print("Table")
  51.     ta = {PosX = x,PosY = y,Text = text,Color_Text = color_text,Color_Fond = color_fond}
  52.     return(ta)
  53. end
  54.  
  55. function plage(ta,min,max,element)
  56.     --print("plage")
  57.     for i = min,max do
  58.     ta[i] = element
  59.     end
  60. end
  61.  
  62. function PrintM (tab)
  63.     --print(tab.Color_Text)
  64.     m.setTextColor(tab.Color_Text)
  65.     m.setBackgroundColor(tab.Color_Fond)
  66.     --print("test")
  67.     m.setCursorPos(tab.PosX,tab.PosY)
  68.     m.write(tab.Text)
  69. end
  70.  
  71.  
  72.  
  73. --################# MAIN CODE ##########################
  74.  
  75.  
  76.  
  77. repeat
  78.     def()
  79.     EMC = EMC + 1
  80.     Box(Box.A[1],colors.blue)
  81.     Tab.Titre = Table(Tab.Titre,ColoneA+5,Ligne[1].Y+1,"main",colors.red,colors.white)
  82.     Tab.RF = Table(Tab.RF, Box.B[2].X,Box.B[2].Y,EMC,colors.yellow,colors.blue)
  83.     PrintM(Tab.Titre)
  84.     PrintM(Tab.RF)
  85.     sleep(1)
  86.  
  87. until EMC > 100
  88.  
  89. --m.clear()
  90. --m.setCursorPos(1,1)
  91. --m.setTextScale(4)
  92. --m.setTextColor(colors.red)
  93. --m.write('ya un blem mon gars')
  94.  
Add Comment
Please, Sign In to add comment