It is currently December 15th, 2019, 6:25 am

Having Trouble, direct example

Help with creating, editing & fixing problems with skins
User avatar
CoffeeJoe
Posts: 17
Joined: November 6th, 2019, 4:19 am

Having Trouble, direct example

CoffeeJoe » November 8th, 2019, 5:21 pm

I have this all wrong, I would like to see what I'm doing wrong here and what I missed. -Thanks

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
DynamicVariables=1
AccurateText=1

[Variables]
VarString="some text"

[Random]
Measure=Calc
Formula=Random
LowBound=1
HighBound=20

[VarText]
Meter=String
IfCondition=[Random] < 17
IfTrueAction=!SetVariable #VarString# "The Value is less than 17"
IfCondition2=[Random] >= 18
IfTrueAction2=!SetVariable #VarString# "The Value is 17 or more"


[Meter]
Meter=String
FontSize=15
FontColor=FFFFFF
SolidColor=101010FF
Padding=15,5,15,5
Text=#VarString#
AntiAlias=1
User avatar
jsmorley
Developer
Posts: 19870
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Having Trouble, direct example

jsmorley » November 8th, 2019, 5:30 pm

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]
VarString=some text

[MeasureRandom]
Measure=Calc
Formula=Random
LowBound=1
HighBound=20
UpdateRandom=1
IfCondition=MeasureRandom < 17
IfTrueAction=[!SetVariable VarString "The Value is less than 17"][!UpdateMeter MeterString][!Redraw]
IfCondition2=MeasureRandom >= 18
IfTrueAction2=[!SetVariable VarString "The Value is 17 or more"][!UpdateMeter MeterString][!Redraw]

[MeterString]
Meter=String
FontSize=15
FontColor=FFFFFF
SolidColor=101010FF
Padding=15,5,15,5
Text=#VarString#
DynamicVariables=1
AntiAlias=1
Take a look at that.

1) You can't put IfConditions on a "meter", they only work on "measures".

2) You shouldn't name a measure [Random], as that then conflicts with the mathematical function "Random" when you use that in a formula or IfCondition.

The standard practice is to name measures [MeasureWhatever] and meters [MeterWhatever]. That both eliminates accidentally causing a conflict like this, and makes it easy to see if a [Section] is a measure or meter at a glance.

3) You need DynamicVariables=1 on any measures or meters that use a variable in a dynamic way. It doesn't and won't work in the [Rainmeter] section.
User avatar
CoffeeJoe
Posts: 17
Joined: November 6th, 2019, 4:19 am

Re: Having Trouble, direct example

CoffeeJoe » November 8th, 2019, 5:48 pm

Awsome
This is making more sense already :)

Thank you so much
User avatar
balala
Rainmeter Sage
Posts: 9267
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Having Trouble, direct example

balala » November 8th, 2019, 6:31 pm

CoffeeJoe wrote:
November 8th, 2019, 5:21 pm
I have this all wrong, I would like to see what I'm doing wrong here and what I missed. -Thanks
Beside jsmorley's code, a few comments related to your original code:
  • As jsmorley well said, IfConditions can't be used on meters, but even if this would be possible, there is no reason to write them as section variables. As you can see on jsmorley's code, nor him wrote them this way. So, the wrongly placed IfCondition=[Random] < 17 and IfCondition2=[Random] >= 18 options of the [VarText] meter, would be enough to be written as IfCondition=Random < 17 and IfCondition2=Random >= 18 (or IfCondition=MeasureRandom < 17 and IfCondition2=MeasureRandom >= 18), because section variables are not needed here. The [Random] measure (later renamed as [MeasureRandom]) is a Calc measure and as such its value is a numeric value, so there is not needed to use it as section variable. This would be indubitably needed if [Random] ([MeasureRandom]) would be a WebParser or String measure (which return a numeric value), but as a Calc measure, it can be used without introducing it as a section variable. It always is preferably to avoid using section variables, to not being forced to set on the dynamic variables.
  • There is no need to use quotes around the options in Rainmeter. For instance remove them from the VarString="some text" variable within the [Variables] section (VarString=some text is alright). Details: https://forum.rainmeter.net/viewtopic.php?f=5&t=26350&p=137628&hilit=quote+enclose+option#p137628.