Steve_E wrote: ↑May 25th, 2023, 1:41 am
Oh, I really do not want to get out of my depth!
Yeah, figured out this much, I was just joking, but you already know that...
Steve_E wrote: ↑May 25th, 2023, 1:41 am
While the Lua script that you kindly provided is working like a charm, if I also wanted to return the Min value in the code you provided above, would I just change 'Max' to 'Min' in this line?
Code: Select all
Substitute="\s+":"","(.)$":"\1,",",+":",","(#V#{129,256})":"(\1)","(#V#{65,128})":"(\1)","(#V#{33,64})":"(\1)","(#V#{17,32})":"(\1)","(#V#{9,16})":"(\1)","(#V#{5,8})":"(\1)","(#V#{3,4})":"(\1)","(#V#{2,2})":"(\1)","(,)([)]+)":"\2\1","([(])":"Max\1",",$":""
Yep, that's all it takes... if you want to
replace the Max value with the Min one. If you want to
add such a value to your skin, it's just as simple, you have to duplicate via copy-paste the [MaxFormula] and [Max] combo of measures to another set that you can obviously name accordingly, e.g. [MinFormula] and [Min], and operate the edit in the substitute you mentioned, but in the new set.
Basically, this code will work with minor changes for every comma separated list of positive / negative integer / fractional values in a string (in your case, the [MeasureEcowittHistory] one). The only thing I didn't do was add more
"(#V#{129,256})":"(\1)",-like parts before that occurrence, in the way I described in the other thread, and that was only because I thought the user should be able to do it easily, considering the obvious progression as slight adjustments to a decreasing list of powers of 2 for the regex {quantifiers} (i.e. how many times the #V# expression is repeated).
All in all, the principle is simple: the original string list is modified by adding brackets and stuff to groups of X values, where X is represented by the powers of 2 and leftovers progression mentioned above. The progression is from larger groups to smaller ones in order to keep the contents between the brackets unchanged and be able to grab the rest of the (smaller) groups properly using the same #V# base pattern (stored as a variable at the start of the code). In a way, it's like formatting a datetime string, except it has more steps. This formatted string from [MaxFormula] is converted to a numerical formula in [Max] and the job is done. That's all there is to it.