It is currently September 16th, 2024, 7:22 pm

Nested Conditions + Formulas

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 8153
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Nested Conditions + Formulas

Post by Yincognito »

sl23 wrote: July 19th, 2024, 2:38 pm Like combining things like above into something like this: X=([mFTotal]<1 ? 0.00001 : (([mFUsed:]/[mFTotal:]*150)+15)) :confused:
X=([mFUsed:]/([mFTotal:]+0.00001)*150+15)

It's just math.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1686
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Nested Conditions + Formulas

Post by sl23 »

Haha, yeah but I haven't used division for 35 years, or much of any other math tbh, least of all formulas. Can't even remember how to transpose them it's been so long! I used to be really good at it, trigonometry was a little tough though.

Would be good to know though, can I use conditional formulas inside a formula like I showed above?

Thanks for the help though! :thumbup:
57686174 77696C6C 6265 77696C6C 6265
User avatar
sl23
Posts: 1686
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Nested Conditions + Formulas

Post by sl23 »

Ah poop! Only works in the test skin!
Sorry, thought it would be the same for use in the skin I wanted it for.:
X=(([m#CURRENTSECTION#:]/[m7Total:]+0.00001)*-#BarH#) This for a shape meter, hence the -#BarH#

Getting four errors still, for each disconnected disk, on every skin update!
57686174 77696C6C 6265 77696C6C 6265
User avatar
balala
Rainmeter Sage
Posts: 16549
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Nested Conditions + Formulas

Post by balala »

sl23 wrote: July 19th, 2024, 1:37 pm Using this to set a shape meter, which works, but it gives four errors, why?
X=([mFUsed:]/[mFTotal:]*150)+15
ERROR: Formula: Division by 0: (7911505920/0*150)+15
This topic has increased too long, maybe the solution has been posted and I missed it (most probably this is the case), but I have a feeling that we're going around the solution of the Division by 0 error message. If it has not been explicitly solved, here is a simple solution: X=([mFTotal]<1 ? 0.00001 : (([mFUsed:]/([mFTotal:]+0.000001)*150)+15)). The added small value doesn1t change the result, but help avoiding the error message.
Sorry if I resumed something already solved.
sl23 wrote: July 19th, 2024, 2:38 pm The manual doesn't give much info on formulas and what does/doesn't work inside them, as it's assumed you know what you're doing.
Doesn't even have to give info related to general math rules, which are applying all the time. You can1t divide something by 0, this is a well-known and always applicable rule.
User avatar
Yincognito
Rainmeter Sage
Posts: 8153
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Nested Conditions + Formulas

Post by Yincognito »

balala wrote: July 19th, 2024, 3:32 pmSorry if I resumed something already solved.
Don't worry, your advice is always welcomed, especially since it wasn't solved on the OP side yet. :thumbup:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1686
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Nested Conditions + Formulas

Post by sl23 »

Sorry balala, that doesn't work either. All disks now have Bars set to zero.

Code: Select all

[sBar]
Shape=Rectangle 0, 0, #BarW#, -#BarH# | StrokeWidth 0 | Fill Color #Bg#
Shape2=Rectangle 0, ([#CURRENTSECTION#Total]<1 ? 0.00001 : (([#CURRENTSECTION#Used:]/([#CURRENTSECTION#Total:]+0.000001)*#BarH#))), #BarW#, 2 | StrokeWidth 0 | Fill Color [#C[#CURRENTSECTION]]
DynamicVariables=1
Hidden=([#CURRENTSECTION#Total:]=0 ? 1 : 0)
X=([#CURRENTSECTION#Used:]=0 ? 0 : 2)R
Y=#BarH#
;X=([mFUsed:]/([mFTotal:]+0.00001)*150+15)
X=([mFTotal]<1 ? 0.00001 : (([#CURRENTSECTION#Used:]/([#CURRENTSECTION#Total:]+0.000001)*-#BarH#)))
[m1]
Meter=Shape
MeterStyle=sBar
X=0
No, still trying to solve it. Appreciate the help, sorry if I'm being a bit dumb here. :oops:
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8153
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Nested Conditions + Formulas

Post by Yincognito »

sl23 wrote: July 19th, 2024, 3:03 pm*-#BarH#
Personally, I would write *(-#BarH#) instead. I'm not comfortable with two operations following immediately after one another, without some operation member between them.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1686
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Nested Conditions + Formulas

Post by sl23 »

balala wrote: July 19th, 2024, 3:32 pm Doesn't even have to give info related to general math rules, which are applying all the time. You can1t divide something by 0, this is a well-known and always applicable rule.
Yes, but I didn't know that having not used division for 35 years! ;-)
Would be good to know though, can I use conditional formulas inside a formula like I showed above?
:thumbup:
57686174 77696C6C 6265 77696C6C 6265
User avatar
sl23
Posts: 1686
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Nested Conditions + Formulas

Post by sl23 »

Thanks for the tip, but that didn't help either! :oops:
57686174 77696C6C 6265 77696C6C 6265
User avatar
sl23
Posts: 1686
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Nested Conditions + Formulas

Post by sl23 »

Aha, solved it, there was a missing : in balala's code! :D
Shape2=Rectangle 0, ([#CURRENTSECTION#Total:]<1 ? 0.00001 : (([#CURRENTSECTION#Used:]/([#CURRENTSECTION#Total:]+0.000001)*(-#BarH#)))), #BarW#, 2 | StrokeWidth 0 | Fill Color [#C[#CURRENTSECTION]]


Thanks you so much for helping. :thumbup:
57686174 77696C6C 6265 77696C6C 6265