So I thought I’d have another crack at this after my long time away. Also, when reminding myself of things I came across a few of the old questions and tricks so I thought it might be a good tutorial revision showcase. I’ll link as many as I can find to reference the original showcases. So…
The main issue is with the expressions for +/- 1/2 hours. You have to cope with crossing the reset number.
I had it as 24h only and was about to publish but realised I would almost certainly get requests to incorporate 12h. Normally that would make the expressions massively rediculous.
Took a break to add AM/PM as A/P and… Wait, no string functions? Ahhh, Yes
I asked that before.
The solution: $condition1?output1:$$condition2 && not condition1?output2:$
Thanks @petruuccios
So, ended with
Hour-2
$#DTIMEFORMAT#==24&&#DbZ#==00?22:$$#DTIMEFORMAT#==24&&#DbZ#=01?23:$$#DTIMEFORMAT#==24&&#DbZ#>01?pad(#DbZ#-2,2):$$#DTIMEFORMAT#==12&&#DbZ#==1?11:$$#DTIMEFORMAT#==12&&#DbZ#==2?12:$$#DTIMEFORMAT#==12&&#DbZ#>2?#DbZ#-2:$
Hour-1
$#DTIMEFORMAT#==24&&#DbZ#==00?23:$$#DTIMEFORMAT#==24&&#DbZ#>0?pad(#DbZ#-1,2):$$#DTIMEFORMAT#==12&&#DbZ#==1?12:$$#DTIMEFORMAT#==12&&#DbZ#>1?#DbZ#-1:$
Hour+1
$#DTIMEFORMAT#==24&&#DbZ#==23?pad(0,2):$$#DTIMEFORMAT#==24&&#DbZ#<23?pad(#DbZ#-(0-1),2):$$#DTIMEFORMAT#==12&&#DbZ#==12?1:$$#DTIMEFORMAT#==12&&#DbZ#<12?#DbZ#-(0-1):$
Hour+2
$#DTIMEFORMAT#==24&&#DbZ#==22?pad(0,2):$$#DTIMEFORMAT#==24&&#DbZ#=23?pad(1,2):$$#DTIMEFORMAT#==24&&#DbZ#<22?pad(#DbZ#-(-2),2):$$#DTIMEFORMAT#==12&&#DbZ#==11?1:$$#DTIMEFORMAT#==12&&#DbZ#=12?2:$$#DTIMEFORMAT#==12&&#DbZ#<11?#DbZ#-(-2):$
So, why #DbZ#-(-2), you may be wondering.
Well if #DbZ#== 02 then (#DbZ#+2) outputs 022 as it treats it as a string first but minus is int only.
I just find it more readable than pad(abs(#DbZ#)+2,2)
The battery was just because I already had a load of shape masks and I wanted a 10% incremental battery bar without a load of masks over a progress so I just added orders of maginitude added together. So for each 10 add 1* 1,10,100 etc:
(abs($#BLN#>90?1:0$)*1000000000+abs($#BLN#>80?1:0$)*100000000+abs($#BLN#>70?1:0$)*10000000+abs($#BLN#>60?1:0$)*1000000+abs($#BLN#>50?1:0$)*100000+abs($#BLN#>40?1:0$)*10000+abs($#BLN#>30?1:0$)*1000+abs($#BLN#>20?1:0$)*100+abs($#BLN#>10?1:0$)*10+abs($#BLN#>0?1:0$)*1)
For some reason you do need the abs() around the output from the conditional.
I did just notice though that I had forgotten to blank the string when battery zero but I’ll fix it there and leave it as an excercise here. I can’t see it being an on arm scenario.