Variables in the Meter option
Posted: June 22nd, 2021, 9:37 pm
Skin:
The above code works, obviously, but try uncommenting the other 3 Meter=... options one at a time and see what happens. In short, the last 2 commented lines don't work and yield errors. Is this the expected behavior or some sort of mini-bug? I understand that in theory there might be some particularities regarding nested variables, but not sure if they should happen in this case - after all, all the Meter=... lines get the same value, i.e. MeterType1's "Image", in various ways.
Why this matters? Well, I'm just trying to avoid having to use a bunch of @Includes to specify different values of the Meter option (which, as you surely know, can't be included in a MeterStyle, thus volatile variables and @includes were my only variants). The @Include variant works perfectly, by the way, it's just that using variables like above is much clearer and easier to debug, since it's in the same file.
EDIT: I think I understood why the measure line fails, it's probably about reading and parsing the skin before the measure gets the chance to execute, not sure about the nested variable line though (this is my preferred variant for this case, by the way).
Code: Select all
[Variables]
MeterType1=Image
MeterTypeIndex=1
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
---Measures---
[MeterType1]
Measure=String
String=Image
UpdateDivider=-1
---Meters---
[MeterString]
Meter=String
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontSize=16
AntiAlias=1
Text="A Red Rectangle Should Be Below Me"
UpdateDivider=-1
DynamicVariables=1
[MeterImage]
Meter=Image
;Meter=#MeterType1#
;Meter=[MeterType1]
;Meter=[#MeterType[#MeterTypeIndex]]
Y=0R
W=[MeterString:W]
H=[MeterString:H]
SolidColor=255,0,0,255
UpdateDivider=-1
DynamicVariables=1
Why this matters? Well, I'm just trying to avoid having to use a bunch of @Includes to specify different values of the Meter option (which, as you surely know, can't be included in a MeterStyle, thus volatile variables and @includes were my only variants). The @Include variant works perfectly, by the way, it's just that using variables like above is much clearer and easier to debug, since it's in the same file.
EDIT: I think I understood why the measure line fails, it's probably about reading and parsing the skin before the measure gets the chance to execute, not sure about the nested variable line though (this is my preferred variant for this case, by the way).