Advertisement
Guest User

Untitled

a guest
Jul 29th, 2015
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. -- Variables primaires
  2.  
  3. local bleu, vert, jaune, rouge, gris, blanc, lvert, orange, marron, noir, lbleu = colors.lightBlue, colors.green, colors.yellow, colors.red, colors.lightGray, colors.white, colors.lime, colors.orange, colors.brown, colors.black, colors.lightBlue
  4. local functionOn = 0
  5.  
  6. local function text(texte, couleur)
  7. term.setTextColor(couleur)
  8. write(texte)
  9. end
  10.  
  11. local function SwitchT(temps)
  12.  
  13. if temps >= 7 and temps <= 18 then
  14. return true
  15. else
  16. return false
  17. end
  18.  
  19. end
  20.  
  21. local function Start()
  22.  
  23. -- Positionnement Programmes
  24.  
  25. for x=1,9 do
  26. for y=1,6 do
  27. paintutils.drawPixel(x, y, jaune)
  28. end
  29. end
  30.  
  31. for x=10,18 do
  32. for y=1,6 do
  33. paintutils.drawPixel(x, y, lvert)
  34. end
  35. end
  36.  
  37. for x=1,9 do
  38. for y=7,12 do
  39. paintutils.drawPixel(x, y, orange)
  40. end
  41. end
  42.  
  43. for x=10,18 do
  44. for y=7,12 do
  45. paintutils.drawPixel(x, y, blanc)
  46. end
  47. end
  48.  
  49. -- Noms programmes
  50.  
  51. term.setTextColor(noir) --Ne pas toucher
  52.  
  53. -- Temps
  54.  
  55. term.setBackgroundColor(jaune)
  56. term.setCursorPos(3,3)
  57. write("Temps")
  58.  
  59. -- Liquide
  60.  
  61. term.setTextColor(lbleu)
  62. term.setBackgroundColor(lvert)
  63. term.setCursorPos(11,3)
  64. write("Liquide")
  65.  
  66. -- Energie
  67.  
  68. term.setTextColor(rouge)
  69. term.setBackgroundColor(orange)
  70. term.setCursorPos(2,9)
  71. write("Energie")
  72. term.setTextColor(noir)
  73.  
  74. -- Infos
  75.  
  76. term.setBackgroundColor(blanc)
  77. term.setCursorPos(12,9)
  78. write("Infos")
  79.  
  80. local bc1 = false
  81.  
  82. while bc1 == false do
  83.  
  84. local event, button, xpos, ypos = os.pullEvent("monitor_touch")
  85.  
  86. if (xpos >= 1 and xpos <= 9) and (ypos >= 1 and ypos <=6) then
  87. functionOn = 1
  88. bc1 = true
  89. elseif (xpos >= 10 and xpos <= 18 and ypos >= 1 and ypos <=6) then
  90. functionOn = 2
  91. bc1 = true
  92. end
  93.  
  94. end
  95.  
  96. end
  97.  
  98. local function Temps() -- Programme du Temps
  99.  
  100. local day = os.day()
  101. local times = os.time()
  102. local time = textutils.formatTime(times, true)
  103.  
  104. term.setBackgroundColor(blanc)
  105.  
  106. term.clear()
  107. term.setCursorPos(4,3)
  108.  
  109. text("Il est ", bleu)
  110. text(time, vert)
  111.  
  112. term.setCursorPos(4,5)
  113.  
  114. text(" le ", bleu)
  115. text(day, orange)
  116.  
  117. if SwitchT(os.time()) then
  118.  
  119. for x=14,17 do
  120. for y=2,5 do
  121. paintutils.drawPixel(x, y, jaune)
  122. end
  123. end
  124.  
  125. else
  126.  
  127. for x=14,17 do
  128. for y=2,5 do
  129. paintutils.drawPixel(x, y, noir)
  130. end
  131. end
  132. paintutils.drawPixel(14, 2, blanc)
  133. paintutils.drawPixel(15, 2, gris)
  134. paintutils.drawPixel(14, 3, gris)
  135. paintutils.drawPixel(15, 3, gris)
  136.  
  137. end
  138.  
  139. for x=1,4 do
  140. for y=9,12 do
  141. paintutils.drawPixel(x, y, blanc)
  142. end
  143. end
  144.  
  145. for x=5,8 do
  146. for y=9,12 do
  147. paintutils.drawPixel(x, y, lvert)
  148. end
  149. end
  150.  
  151. sleep(0.7)
  152.  
  153. end
  154.  
  155. -- Boucle Start
  156.  
  157. while true do
  158.  
  159. if functionOn == 0 then
  160.  
  161. Start()
  162.  
  163. elseif functionOn == 1 then
  164.  
  165. Temps()
  166.  
  167. end
  168.  
  169. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement