It is currently March 28th, 2024, 12:37 pm

How to write "IfCondition" correctly?

Get help with creating, editing & fixing problems with skins
MaestroSky
Posts: 33
Joined: April 20th, 2021, 4:15 pm

How to write "IfCondition" correctly?

Post 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
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm
Contact:

Re: How to write "IfCondition" correctly?

Post 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]
Last edited by death.crafter on June 2nd, 2021, 11:39 am, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How to write "IfCondition" correctly?

Post 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.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm
Contact:

Re: How to write "IfCondition" correctly?

Post 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.
MaestroSky
Posts: 33
Joined: April 20th, 2021, 4:15 pm

Re: How to write "IfCondition" correctly?

Post 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
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm
Contact:

Re: How to write "IfCondition" correctly?

Post by death.crafter »

MaestroSky wrote: June 2nd, 2021, 11:49 am
Are you getting the values from webparser correct?
MaestroSky
Posts: 33
Joined: April 20th, 2021, 4:15 pm

Re: How to write "IfCondition" correctly?

Post 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
MaestroSky
Posts: 33
Joined: April 20th, 2021, 4:15 pm

Re: How to write "IfCondition" correctly?

Post by MaestroSky »

death.crafter wrote: June 2nd, 2021, 11:58 am
Yes I checked if U below [MeasureCreated_at1] doesn't work for some reason
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to write "IfCondition" correctly?

Post 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?
MaestroSky
Posts: 33
Joined: April 20th, 2021, 4:15 pm

Re: How to write "IfCondition" correctly?

Post 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.
Attachments
Screenshot_1.png
Post Reply