I'm not sure if this is already known, but using relative positioning inside of a conditional operation doesn't work. It works if you use R after the conditional operation, but not inside.
For example, I was trying to use Y=((#hideDiskA# = 0) ? (#rowSpacing# + 2)R : #contentMargin#). This doesn't work and throws an error, saying Formula: "R" is unknown: ((1=0) ? (1 + 2)R : (5 + 3)). However, if I do something like Y=((#hideDiskA# = 0) ? (#rowSpacing# + 2) : #contentMargin#)R, it resolves and works perfectly, but doesn't work for my needs.
If this could be fixed it would make my life significantly easier.
It is currently April 26th, 2024, 3:19 am
[Bug?] Using R inside of a conditional operation doesn't resolve
-
- Posts: 660
- Joined: June 25th, 2015, 7:02 pm
- Location: The Sky, USA
-
- Rainmeter Sage
- Posts: 16172
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: [Bug?] Using R inside of a conditional operation doesn't resolve
No, it probably can't be, because those conditional operations must be entirely numeric, strings are not allowed. Not even the r or R, used for relative positioning. Sorry...raiguard wrote:If this could be fixed it would make my life significantly easier.
-
- Posts: 660
- Joined: June 25th, 2015, 7:02 pm
- Location: The Sky, USA
Re: [Bug?] Using R inside of a conditional operation doesn't resolve
Aw dang. Is this an intentional choice or is it a consequence of the design? I completely understand not having actual strings, but r or R should be usable.
I guess I could just use a section variable to do it instead.
I guess I could just use a section variable to do it instead.
-
- Developer
- Posts: 22630
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: [Bug?] Using R inside of a conditional operation doesn't resolve
It's not so much that it is intentional, but that a ternary operation is a standard C language construct, and it is by its nature a purely numeric mathematical function. We have no intention of re-writing the entire C language math library from scratch, any more than we intend to re-write the entire Windows API library from scratch.raiguard wrote:Aw dang. Is this an intentional choice or is it a consequence of the design? I completely understand not having actual strings, but r or R should be usable.
I guess I could just use a section variable to do it instead.
The documentation for Formulas in Rainmeter is pretty clear about what is allowed and what isn't in a mathematical formula.
You can use "R" or "r" in the X or Y option of a meter that uses a formula, as long as the "R" or "r" modifiers are outside the formula.Note: While [Measures], [SectionVariables:] and #Variables# can be used in a formula, all the components of a formula must be numeric, using only numbers, operators, functions and constants. Using .5 or .25 in a formula will cause an error. It must be 0.5 or 0.25.
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Variables]
Var1=5
Var2=6
[MeterOne]
Meter=String
X=0
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Hello
[MeterTwo]
Meter=String
X=(#Var2# > #Var1# ? 20 : 10)R
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=World
-
- Rainmeter Sage
- Posts: 16172
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: [Bug?] Using R inside of a conditional operation doesn't resolve
Please post your code, maybe we can find a solution.raiguard wrote:However, if I do something like Y=((#hideDiskA# = 0) ? (#rowSpacing# + 2) : #contentMargin#)R, it resolves and works perfectly, but doesn't work for my needs.
-
- Posts: 660
- Joined: June 25th, 2015, 7:02 pm
- Location: The Sky, USA
Re: [Bug?] Using R inside of a conditional operation doesn't resolve
It’s 6000 lines long, so here’s the file on GitHub: https://github.com/raiguard/ModernGadgets/blob/master/Skins/ModernGadgets/Disks/Disks.inibalala wrote:Please post your code, maybe we can find a solution.
I’m in the middle of some major refactoring so it’s kinda broken at the moment.
However, I did figure out how to do it with section variables, so it’s good now anyway. Thanks for the help.
-
- Rainmeter Sage
- Posts: 16172
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: [Bug?] Using R inside of a conditional operation doesn't resolve
And this means you don't need further help about your question any more?raiguard wrote:However, I did figure out how to do it with section variables, so it’s good now anyway. Thanks for the help.
-
- Posts: 660
- Joined: June 25th, 2015, 7:02 pm
- Location: The Sky, USA
Re: [Bug?] Using R inside of a conditional operation doesn't resolve
Nope. Since jsmorley said it couldn’t be fixed, I found another way. Thanks.balala wrote:And this means you don't need further help about your question any more?
-
- Developer
- Posts: 22630
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: [Bug?] Using R inside of a conditional operation doesn't resolve
Great. There is nothing to "fix". It works exactly as it should.raiguard wrote:Nope. Since jsmorley said it couldn’t be fixed, I found another way. Thanks.