Advertisement
xerpi

Untitled

Apr 12th, 2011
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.08 KB | None | 0 0
  1. alpha = color.new(0,0,0,0)
  2. blue = color.new(0,0,255)
  3. green = color.new(0,255,0)
  4. red = color.new(255,0,0)
  5. white = color.new(255,255,255)
  6. yellow = color.new(155,155,0)
  7. pink = color.new(255,192,203)
  8. black = color.new(0,0,0)
  9. gold= color.new(255,215,0)
  10. orange = color.new(255,160,0)
  11. alphawhite = color.new(255,255,255,124)
  12.  
  13.  
  14.  
  15. function batteryandtime()
  16.  
  17. if batt.exists() then
  18.     if batt.charging()  and tiempo:time() >= 500 and tiempo:time() <= 1000 then
  19.         if batt.percent() >0 and batt.percent() <=25 then
  20.         draw.fillrect(300+115, 2,math.ceil((batt.percent()*14)/100), 9,red)
  21.         elseif batt.percent() >25 and batt.percent() <=50 then
  22.         draw.fillrect(300+115, 2,math.ceil((batt.percent()*14)/100), 9,orange)
  23.         elseif batt.percent() >50 and batt.percent() <=75 then
  24.         draw.fillrect(300+115, 2,math.ceil((batt.percent()*14)/100), 9,yellow)
  25.         elseif batt.percent() >75 and batt.percent() <=100 then
  26.         draw.fillrect(300+115, 3,14,7,green)
  27.         end
  28.         draw.line(300+114, 2, 315+114, 2,white)
  29.         draw.line(300+114, 10, 315+114, 10,white)
  30.         draw.line(300+114, 2, 300+114, 10,white)
  31.         draw.line(316+114, 4, 316+114, 8,white)
  32.         draw.line(315+114, 2, 315+114, 11,white)
  33.         draw.line(315+114, 4, 317+114, 4,white)
  34.         draw.line(315+114, 8, 317+114, 8,white)
  35.         draw.line(317+114, 4, 317+114, 9,white)
  36.     elseif batt.charging()==false then
  37.         if batt.percent() >0 and batt.percent() <=25 then
  38.         draw.fillrect(300+115, 2,math.ceil(math.ceil(batt.percent()/14)), 9,red)
  39.         elseif batt.percent() >25 and batt.percent() <=50 then
  40.         draw.fillrect(300+115, 2,math.ceil((batt.percent()*14)/100), 9,orange)
  41.         elseif batt.percent() >50 and batt.percent() <=75 then
  42.         draw.fillrect(300+115, 2,math.ceil((batt.percent()*14)/100), 9,yellow)
  43.         elseif batt.percent() >75 and batt.percent() <=100 then
  44.         draw.fillrect(300+115, 3,14,7,green)
  45.         end
  46.         draw.line(300+114, 2, 315+114, 2,white)
  47.         draw.line(300+114, 10, 315+114, 10,white)
  48.         draw.line(300+114, 2, 300+114, 10,white)
  49.         draw.line(316+114, 4, 316+114, 8,white)
  50.         draw.line(315+114, 2, 315+114, 11,white)
  51.         draw.line(315+114, 4, 317+114, 4,white)
  52.         draw.line(315+114, 8, 317+114, 8,white)
  53.         draw.line(317+114, 4, 317+114, 9,white)
  54. end
  55. else    
  56.         draw.fillrect(300+115, 3,14,7,blue)
  57.         draw.line(300+114, 2, 315+114, 2,white)
  58.         draw.line(300+114, 10, 315+114, 10,white)
  59.         draw.line(300+114, 2, 300+114, 10,white)
  60.         draw.line(316+114, 4, 316+114, 8,white)
  61.         draw.line(315+114, 2, 315+114, 11,white)
  62.         draw.line(315+114, 4, 317+114, 4,white)
  63.         draw.line(315+114, 8, 317+114, 8,white)
  64.         draw.line(317+114, 4, 317+114, 9,white)
  65. end
  66.  
  67. if batt.exists() then  
  68. screen.print(319+115,2,batt.percent().."%",size,white,alpha)
  69. end
  70.  
  71. screen.print(290,2,os.date("%x"),size,white,alpha)
  72. screen.print(290+screen.textwidth(os.date("%x").."  "),2,os.date("%H"),size,white,alpha)
  73. screen.print(290+screen.textwidth(os.date("%x").."  "..os.date("%H")..":"),2,os.date("%M"),size,white,alpha)
  74. if tiempo:time() >= 500 and tiempo:time() <= 1000 then
  75.     screen.print(290+screen.textwidth(os.date("%x").."  "..os.date("%H")),2,":",size,white,alpha)
  76. elseif tiempo:time() >= 1000 then tiempo:reset()
  77. end
  78. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement