It is currently March 28th, 2024, 11:21 am

Conditional Operators : Meter Width Variables

Get help with creating, editing & fixing problems with skins
Post Reply
nawuve
Posts: 2
Joined: February 23rd, 2019, 5:39 pm

Conditional Operators : Meter Width Variables

Post by nawuve »

Could someone explain to me what is wrong with this code? It does not give either 20 or 10 ([Meter1:W] and [Meter2:W] respectively).

Code: Select all

[WidthCalc]
 Measure=Calc
 Formula=([Meter1:W] < [Meter2:W] ? [Meter1:W] : [Meter2:W])

[Meter1]
 Meter=String
 W=20

[Meter2]
 Meter=String
 W=10

[Result]
 Meter=String
 SolidColor=1
 FontSize=30
 Text=[WidthCalc]
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Conditional Operators : Meter Width Variables

Post by balala »

nawuve wrote: March 2nd, 2019, 5:14 pm Could someone explain to me what is wrong with this code? It does not give either 20 or 10 ([Meter1:W] and [Meter2:W] respectively).
The [WidthCalc] measure requires a DynamicVariables=1 option, because section variables are used.

Additional tip: don't use a Text=[WidthCalc] option on the [Result] meter (which also would require as well a DynamicVariables=1 option in certain circumstances). Instead add a MeasureName=WidthCalc option and replace the text option with Text=%1.
nawuve
Posts: 2
Joined: February 23rd, 2019, 5:39 pm

Re: Conditional Operators : Meter Width Variables

Post by nawuve »

Oh that makes sense, thanks!
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Conditional Operators : Meter Width Variables

Post by balala »

Glad to help.
Post Reply