It is currently March 29th, 2024, 2:04 pm

[Solved] Calc not working. (IfEqualValue=0 not working)

Get help with creating, editing & fixing problems with skins
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

[Solved] Calc not working. (IfEqualValue=0 not working)

Post by JpsCrazy »

How I fixed it: With the help of jsmorley, I added an IfAboveStatement to reverse the IfEqualStatement.


I'm working on a game, and right now I'm making a calc to check if the money reaches 0 and if so, text appears which lets you reset everything with !RainmeterRefresh.
Problem is the calc, with formula=50, always comes out as 0.
I also made a single skin with JUST that, in fact more simplified. Same problem.

No other measures or meters have the same names.


The problem area:

Code: Select all

[msNoMoney]
Measure=Calc
Formula=50
DynamicVariables=1
IfBelowValue=1
IfBelowAction=!Execute [!RainmeterHideMeter mtStart][!RainmeterShowMeter mtTryAgain]

[mtTryAgain]
Meter=String
Text=[Try Again?]
FontSize=8
AntiAlias=1
LeftMouseUpAction=!Execute [!RainmeterRefresh]
SolidColor=00000001
Hidden=1
X=74
Y=0
It originally was Formula=#Money#, but thinking there could have been a problem with the variable and such I switched it to a non-dynamic number. Also used IfEqualValue/Action before, but tried IfBelow just in case.
Last edited by JpsCrazy on June 18th, 2010, 3:37 pm, edited 9 times in total.
dragonmage
Developer
Posts: 1270
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: Calc not working.

Post by dragonmage »

Remove DynamicVariables=1 from [msNoMoney] there is nothing dynamic in there.
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: Calc not working.

Post by JpsCrazy »

As stated below the code, I was using a dynamic variable before when I noticed problems, then switched to a regular number. (...but I totally wrote Measure=#Money# when I meant Formula=#Money# in the description.)

Removed DynamicVariables=1 and it's still not working.
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Calc not working.

Post by smurfier »

Strange as it works for me. Try a clean-reinstall.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: Calc not working.

Post by JpsCrazy »

This is really frustrating...

I was a bit skeptical, but I tried it...
Did a clean reinstall.
Didn't help.

As simple as I could make it:

Code: Select all

[Rainmeter]

[Variables]
Var=9

[msNoMoney]
Measure=Calc
Formula=#Var#
IfEqualValue=0
IfEqualAction=!Execute [!RainmeterShowMeter mtTryAgain]

[mtTryAgain]
Meter=String
Text=There is 0. Lol...
FontSize=8
AntiAlias=1 
SolidColor=00000001
Hidden=1

Code: Select all

[Rainmeter]

[Variables]
Var=9

[msNoMoney]
Measure=Calc
Formula=9
IfEqualValue=0
IfEqualAction=!Execute [!RainmeterShowMeter mtTryAgain]

[mtTryAgain]
Meter=String
Text=There is 0. Lol...
FontSize=8
AntiAlias=1 
SolidColor=00000001
Hidden=1
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Calc not working.

Post by smurfier »

did you try it without the ifequal part?
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: Calc not working.

Post by JpsCrazy »

Weird. O.O

If I remove the IfEqualValue and use it as a variable for the meter it works fine.

I messed around with it a bit more, and found if the IfEqualValue is anything but 0 it works like it should. (At least by what I've tested.)


What's going on?
User avatar
kenz0
Developer
Posts: 263
Joined: July 31st, 2009, 2:23 pm
Location: Tokyo, JPN

Re: Calc not working.

Post by kenz0 »

Calc measure has the feature which once outputs a default value (i.e. zore), before outputting a calculation value (or Variables). So if "0" is defined in IfEqualValue, it will surely be executed at the start.
.
Image
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: Calc not working.

Post by JpsCrazy »

kenz0 wrote:Calc measure has the feature which once outputs a default value (i.e. zore), before outputting a calculation value (or Variables). So if "0" is defined in IfEqualValue, it will surely be executed at the start.
...I have no idea what you mean.
So you're saying before a calc is equal to whatever it should be, before it calculates, it's default value is 0?
Nonetheless, shouldn't it update when the skin updates?
This really does seem to make sense, but this ruins any IfBelow statement. I tested them, and I couldn't get a single one to work... which would make sense if the default value is 0. Tested a IfBelowValue=-5 and well, it worked as it should. So any IfBelowStatement with positive numbers is broken.

I'm sorry. I'm really frustrated.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Calc not working.

Post by jsmorley »

JpsCrazy wrote: ...I have no idea what you mean.
So you're saying before a calc is equal to whatever it should be, before it calculates, it's default value is 0?
Nonetheless, shouldn't it update when the skin updates?
This really does seem to make sense, but this ruins any IfBelow statement. I tested them, and I couldn't get a single one to work... which would make sense if the default value is 0. Tested a IfBelowValue=-5 and well, it worked as it should. So any IfBelowStatement with positive numbers is broken.

I'm sorry. I'm really frustrated.
It's not that it is broken, it is just that you have to understand that an IF action is fired when it becomes true. It does NOT fire again, until it becomes false, and then true again. It is that way on purpose so it doesn't just get into a runaway loop of firing the action. So since the value of a calc or other measure starts as "0", an IfBelowAction statement is going to be true if the IfBelowValue is positive. It will stay true until the value is either above or equal to the IfBelowValue and then goes back to below.

It's how it works. There is always a way around any limitations this causes by clever use of corresponding IfEqual and IfAbove statements, but it's not "broken".

For instance if you wanted a meter to indicate that your hard drives space was below some preset target, you would set the IfBelowValue accordingly. When the skin is run it will initially be true (since I presume the limit would be above zero) but would become false as soon as the measure in question checks the hard drive and IfBelowValue is now untrue. It would remain untrue, no matter how much more hard drivie space you gained or lost, until it fell below the target once again.