Help with battery charging icon switching

So l’m trying to get my battery icon to shuffle through each stage of the icon while it’s charging. What i have so far works, expect, for some unexplained reason, the last icon (batt-full). The icon name is correct because it works when not charging. My code is below (| know there is a cleaner way to this but wanted it all laid out nicely for troubleshooting). A random icon pops up each time the battery should be the full icon. I have a global timer that counts from 1 to 5. Any help would be appreciated.

$tu(seq, 1/60, 1, 5)$

$if(bi(charging)=0,
if(bi(level)>75, "batt-full’,
bi(level)>50, “batt-three-quarter”,
bi(level)>25, “batt-half”,
bi(level)>10, “batt-quarter”,
bi(level)>0, “batt-empty”),
if(gv(bTimer)=1, “batt-empty”,
gv(bTimer)=2, “batt-quarter”,
gv(bTimer)=3, “batt-half”,
gv(bTimer)=4, “batt-three-quarter”,
gv(bTimer)=5, “batt-full”)$

There were some errors with the kode above, although once fixed, I’m not sure why it still wasn’t working. Here is a solution that worked though.

$lv(1,“batt-empty”)$
$lv(2,“batt-quarter”)$
$lv(3,“batt-half”)$
$lv(4,“batt-three-quarter”)$
$lv(5,“batt-full”)$

$if(bi(charging)=0,
if(bi(level)>75, lv(5),
bi(level)>50, lv(4),
bi(level)>25, lv(3),
bi(level)>10, lv(2),
bi(level)>0, lv(1)),
lv(gv(bTimer)))$

1 Like

This topic was automatically closed 25 days after the last reply. New replies are no longer allowed.