Page 1 of 3
How to write "IfCondition" correctly?
Posted: June 2nd, 2021, 9:36 am
by MaestroSky
Help me solve the problem!
The #U# parameter changes, but it does not count IfCondition1, 2 and 3.
How do I get it to replace the text according to #U# ?
Code: Select all
[Rainmeter]
Update=1000
DefaultUpdateDivider=1
AccurateText=1
DynamicWindowSize=1
[Metadata]
Name=Test
[Variables]
MeasureGMTime=135
UpdateTime=100
U=132233684
[MeasureCurrentTime]
Measure=Calc
IfCondition=#U# < MeasureCreated_at1
IfTrueAction=[!SetOption Meter1 Text "[MeasureCreated_at1]"]
IfFalseAction=[!SetOption Meter1 Text #U#]
IfCondition2=(MeasureCreated_at2 >= #U#) && (MeasureCreated_at3 <= #U#)
IfTrueAction2=[!SetOption Meter1 Text "[MeasureCreated_at2]"]
IfFalseAction2=[!SetOption Meter1 Text #U#]
IfCondition3=(MeasureCreated_at3 >= #U#) && (MeasureCreated_at2 <= #U#)
IfTrueAction3=[!SetOption Meter1 Text "[MeasureCreated_at3]"]
IfFalseAction3=[!SetOption Meter1 Text #U#]
OnChangeAction=[!UpdateMeter Meter1][!Redraw]
UpdateDivider=1
DynamicVariables=1
[InfoGM]
Measure=WebParser
URL=https://api.worldoftanks.ru/wot/clans/list/?application_id=bf049cf6db102d4f0536904348d02500
RegExp={"status":.*color":"(.*)","created_at":(.*),"tag":.*color":"(.*)","created_at":(.*),"tag":.*color":"(.*)","created_at":(.*),"tag":
DynamicVariables=1
UpdateRate=#UpdateTime#
[MeasureCreated_at1]
Measure=WebParser
URL=[InfoGM]
StringIndex=2
;RegExpSubstitute=1
DynamicVariables=1
[MeasureCreated_at2]
Measure=WebParser
URL=[InfoGM]
StringIndex=4
;RegExpSubstitute=1
DynamicVariables=1
[MeasureCreated_at3]
Measure=WebParser
URL=[InfoGM]
StringIndex=6
;RegExpSubstitute=1
DynamicVariables=1
[Meter1]
Meter=String
MeterStyle=styleRightText
StringStyle=Bold
FontFace=Roboto Condensed
FontSize=10
AntiAlias=1
X=0
Y=0
W=250
H=30
Text=Error!
ToolTipType=1
DynamicVariables=1
Hidden=0
Re: How to write "IfCondition" correctly?
Posted: June 2nd, 2021, 11:11 am
by death.crafter
MaestroSky wrote: ↑June 2nd, 2021, 9:36 am
Help me solve the problem!
The #U# parameter changes, but it does not count IfCondition1, 2 and 3.
How do I get it to replace the text according to #U# ?
Explanations inside
________________________________________
________________________________________
And changes inside
________________________________________
--------------------------------------------------------- |
Code: Select all
[MeasureCurrentTime]
Measure=Calc
IfCondition=#U# < MeasureCreated_at1
IfTrueAction=[!SetOption Meter1 Text "[MeasureCreated_at1]"]
IfFalseAction=[!SetOption Meter1 Text #*U*#]
IfCondition2=(MeasureCreated_at2 >= #U#) && (MeasureCreated_at3 <= #U#)
IfTrueAction2=[!SetOption Meter1 Text "[MeasureCreated_at2]"]
IfFalseAction2=[!SetOption Meter1 Text #*U*#]
IfCondition3=(MeasureCreated_at3 >= #U#) && (MeasureCreated_at2 <= #U#)
IfTrueAction3=[!SetOption Meter1 Text "[MeasureCreated_at3]"]
IfFalseAction3=[!SetOption Meter1 Text #*U*#]
________________________________________________________
;---------------------This is not going to work since the measure MeasureCurrentTime never changes.
;---------------------So you just have to update this measure everytime the other three measures change and use OnUpdateAction.
;---------------------OnChangeAction=[!UpdateMeter Meter1][!Redraw]
________________________________________________________
OnUpdateAction=[!UpdateMeter Meter1][!Redraw]
--------------------------------------------------------------------------------
________________________________________________________
;---------------------I am putting UpdateDivider to be -1 so that skin doesn't redraw every update but only
;---------------------when the value of other measures change and this measure is updated.
;---------------------UpdateDivider=1
_________________________________________________________
UpdateDivider=-1
----------------------------------------------------------------------------------
DynamicVariables=1
[MeasureCreated_at1]
Measure=WebParser
URL=[InfoGM]
StringIndex=2
;RegExpSubstitute=1
DynamicVariables=1
_________________________________________________________
OnChangeAction=[!UpdateMeasure MeasureCurrentTime]
---------------------------------------------------------------------------------
[MeasureCreated_at2]
Measure=WebParser
URL=[InfoGM]
StringIndex=4
;RegExpSubstitute=1
DynamicVariables=1
OnChangeAction=[!UpdateMeasure MeasureCurrentTime]
[MeasureCreated_at3]
Measure=WebParser
URL=[InfoGM]
StringIndex=6
;RegExpSubstitute=1
DynamicVariables=1
OnChangeAction=[!UpdateMeasure MeasureCurrentTime]
Re: How to write "IfCondition" correctly?
Posted: June 2nd, 2021, 11:20 am
by jsmorley
Just a minor aside, you actually don't have to have a Formula option on a Calc measure if the intent is just to use the measure as a "host" for one or more IfConditions.
Code: Select all
[MeasureCalc]
Measure=Calc
IfCondition=1 = 1
IfTrueAction=[!Log "True"]
The default it will use is
Formula=0.
Re: How to write "IfCondition" correctly?
Posted: June 2nd, 2021, 11:40 am
by death.crafter
jsmorley wrote: ↑June 2nd, 2021, 11:20 am
Just a minor aside, you actually don't have to have a Formula option on a Calc measure if the intent is just to use the measure as a "host" for one or more IfConditions.
Code: Select all
[MeasureCalc]
Measure=Calc
IfCondition=1 = 1
IfTrueAction=[!Log "True"]
The default it will use is
Formula=0.
My whole life was a lie
.
Jokes aside, thanks for correcting me.
Re: How to write "IfCondition" correctly?
Posted: June 2nd, 2021, 11:49 am
by MaestroSky
death.crafter wrote: ↑June 2nd, 2021, 11:11 am
I corrected everything as you indicated, but nothing happens when you change it [Variables] U=.
Code: Select all
[Rainmeter]
Update=1000
DefaultUpdateDivider=1
AccurateText=1
DynamicWindowSize=1
[Metadata]
Name=background2
[Variables]
MeasureGMTime=135
UpdateTime=100
U=13433684
[MeasureCurrentTime]
Measure=Calc
IfCondition=#U# < MeasureCreated_at1
IfTrueAction=[!SetOption Meter1 Text "[MeasureCreated_at1]"]
IfFalseAction=[!SetOption Meter1 Text #*U*#]
IfCondition2=(MeasureCreated_at2 >= #U#) && (MeasureCreated_at3 <= #U#)
IfTrueAction2=[!SetOption Meter1 Text "[MeasureCreated_at2]"]
IfFalseAction2=[!SetOption Meter1 Text #*U*#]
IfCondition3=(MeasureCreated_at3 >= #U#) && (MeasureCreated_at2 <= #U#)
IfTrueAction3=[!SetOption Meter1 Text "[MeasureCreated_at3]"]
IfFalseAction3=[!SetOption Meter1 Text #*U*#]
OnUpdateAction=[!UpdateMeter Meter1][!Redraw]
UpdateDivider=-1
DynamicVariables=1
[InfoGM]
Measure=WebParser
URL=https://api.worldoftanks.ru/wot/clans/list/?application_id=bf049cf6db102d4f0536904348d02500
RegExp={"status":.*color":"(.*)","created_at":(.*),"tag":.*color":"(.*)","created_at":(.*),"tag":.*color":"(.*)","created_at":(.*),"tag":
DynamicVariables=1
UpdateRate=#UpdateTime#
[MeasureCreated_at1]
Measure=WebParser
URL=[InfoGM]
StringIndex=2
OnChangeAction=[!UpdateMeasure MeasureCurrentTime]
DynamicVariables=1
[MeasureCreated_at2]
Measure=WebParser
URL=[InfoGM]
StringIndex=4
OnChangeAction=[!UpdateMeasure MeasureCurrentTime]
DynamicVariables=1
[MeasureCreated_at3]
Measure=WebParser
URL=[InfoGM]
StringIndex=6
OnChangeAction=[!UpdateMeasure MeasureCurrentTime]
DynamicVariables=1
[Meter1]
Meter=String
MeterStyle=styleRightText
StringStyle=Bold
FontFace=Roboto Condensed
FontSize=10
AntiAlias=1
X=0
Y=0
W=250
H=30
Text=Error!
ToolTipType=1
DynamicVariables=1
Hidden=0
Re: How to write "IfCondition" correctly?
Posted: June 2nd, 2021, 11:58 am
by death.crafter
Are you getting the values from webparser correct?
Re: How to write "IfCondition" correctly?
Posted: June 2nd, 2021, 12:40 pm
by MaestroSky
death.crafter wrote: ↑June 2nd, 2021, 11:58 am
Are you getting the values from webparser correct?
Yes, the output parameters work, I reviewed and saw that #U# does not match the required number of characters.
Thank you, I will fasten this to my skin
Re: How to write "IfCondition" correctly?
Posted: June 2nd, 2021, 12:57 pm
by MaestroSky
Yes I checked if U below [MeasureCreated_at1] doesn't work for some reason
Re: How to write "IfCondition" correctly?
Posted: June 2nd, 2021, 3:27 pm
by balala
MaestroSky wrote: ↑June 2nd, 2021, 12:57 pm
Yes I checked if U below [MeasureCreated_at1] doesn't work for some reason
It does work. Just tried out the
original code and definitely works. What do you mean by "doesn't work"? What the [Meter1] meter is returning?
Re: How to write "IfCondition" correctly?
Posted: June 2nd, 2021, 3:52 pm
by MaestroSky
balala wrote: ↑June 2nd, 2021, 3:27 pm
The U parameter is now less than Mesuare..at2 by 1
Which means that the data should show me the Mesuare values..at2 a shows me the U values.