It is currently November 15th, 2019, 11:19 am

Help With WebParser and IfConditions

Help with creating, editing & fixing problems with skins
justsomeguyhere
Posts: 15
Joined: July 12th, 2019, 7:29 pm

Help With WebParser and IfConditions

justsomeguyhere » August 13th, 2019, 12:50 pm

God I'm awful at IfConditions. So I saw this one skin that told you hey why don't you put on a jacket, it's cold outside. So I was like, that looks cool why don't I remake it without looking into how it was coded. Short answer is I'm stuck, long answer is I feel like it should work but isn't. Can I have some help on this. There are 4 preset phrases that I want to display and 4 IfConditions written to switch between them when the temperature shifts into a different range.
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 19710
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help With WebParser and IfConditions

jsmorley » August 13th, 2019, 1:00 pm

The first thing that jumps out at me is that you are using a bang [!SetVarriable... which is spelled wrong. It should be [!SetVariable...

See if that doesn't help...
justsomeguyhere
Posts: 15
Joined: July 12th, 2019, 7:29 pm

Re: Help With WebParser and IfConditions

justsomeguyhere » August 13th, 2019, 1:10 pm

I fixed the spelling oversight. It didn't help :( I don't know how you plan on testing it, but what I've been doing it changing the Jacket Variable and seeing if the calc measures change it back to what it should be.
justsomeguyhere
Posts: 15
Joined: July 12th, 2019, 7:29 pm

Re: Help With WebParser and IfConditions

justsomeguyhere » August 13th, 2019, 1:13 pm

I figured part of it out. It was poor IfConditions syntax. I just didn't number them lol. Still doesn't work though
User avatar
jsmorley
Developer
Posts: 19710
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help With WebParser and IfConditions

jsmorley » August 13th, 2019, 1:23 pm

Try this for those two measures:

Code: Select all

[MeasureTempSweater]
Measure=Calc
Formula=[MeasureTempCurrent]
IfCondition=(#CURRENTSECTION#>=65)
IfTrueAction=[!SetVariable Jacket "0"][!UpdateMeasure "MeasureJacketState"]
IfCondition2=(#CURRENTSECTION#<65) && (#CURRENTSECTION#>=40)
IfTrueAction2=[!SetVariable Jacket "1"][!UpdateMeasure "MeasureJacketState"]
IfCondition3=(#CURRENTSECTION#<40) && (#CURRENTSECTION#>=20)
IfTrueAction3=[!SetVariable Jacket "2"][!UpdateMeasure "MeasureJacketState"]
IfCondition4=(#CURRENTSECTION#<20)
IfTrueAction4=[!SetVariable Jacket "3"][!UpdateMeasure "MeasureJacketState"]
DynamicVariables=1

[MeasureJacketState]
Measure=Calc
Formula=#Jacket#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!ShowMeter "MeterNoJacket"][!HideMeter "MeterSureJacket"][!HideMeter "MeterYesJacket"][!HideMeter "MeterDefinitelyJacket"][!UpdateMeter *][!Redraw]
IfCondition2=(#CURRENTSECTION#=1)
IfTrueAction2=[!HideMeter "MeterNoJacket"][!ShowMeter "MeterSureJacket"][!HideMeter "MeterYesJacket"][!HideMeter "MeterDefinitelyJacket"][!UpdateMeter *][!Redraw]
IfCondition3=(#CURRENTSECTION#=2)
IfTrueAction3=[!HideMeter "MeterNoJacket"][!HideMeter "MeterSureJacket"][!ShowMeter "MeterYesJacket"][!HideMeter "MeterDefinitelyJacket"][!UpdateMeter *][!Redraw]
IfCondition4=(#CURRENTSECTION#=3)
IfTrueAction4=[!HideMeter "MeterNoJacket"][!HideMeter "MeterSureJacket"][!HideMeter "MeterYesJacket"][!ShowMeter "MeterDefinitelyJacket"][!UpdateMeter *][!Redraw]
DynamicVariables=1
The primary problem is that you are using || (or) when the logic is really && (and). You also need DynamicVariables=1 on those measures.
justsomeguyhere
Posts: 15
Joined: July 12th, 2019, 7:29 pm

Re: Help With WebParser and IfConditions

justsomeguyhere » August 13th, 2019, 2:21 pm

Thank you for your help! I'll get back to you when the temperature dips into one of the predetermined ranges.
User avatar
jsmorley
Developer
Posts: 19710
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help With WebParser and IfConditions

jsmorley » August 13th, 2019, 2:26 pm

You can test it by temporarily changing:

Code: Select all

[MeasureTempCurrent]
Measure=String
String=30
;Measure=Plugin
;Plugin=WebParser
;URL=[measureWeather]
;StringIndex=4
UpdateRate=#VarUpdateRate#
Set String equal to whatever you want.
justsomeguyhere
Posts: 15
Joined: July 12th, 2019, 7:29 pm

Re: Help With WebParser and IfConditions

justsomeguyhere » August 13th, 2019, 3:22 pm

Yay. It works. Thank you so much for your help!!!
User avatar
jsmorley
Developer
Posts: 19710
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Help With WebParser and IfConditions

jsmorley » August 13th, 2019, 3:23 pm

Glad to help.