Hi,
I have variables x1 - x20 and a variable y which takes values from 1 to 20.
Now, I'd like to set variable z to the value of x1-20 depending on status of y.
[!setVariable z x#y#] sets z to the name of the variable, but of course not to the value... :/
Is there any syntax to achieve this, or do I need to take the long way with some IfMatch... ?
It is currently March 28th, 2024, 5:12 pm
Referencing to a variable using a variable in its name :/
Re: Referencing to a variable usng a variable in its name :/
I'm not sure I quite understand, but I think this could help? [!SetVariable z #x1##y1#]
All variables usually are surrounded by #, but they have a different syntax if they're nested. If this isn't it, then maybe look at nested variables: https://docs.rainmeter.net/manual/variables/nesting-variables/
All variables usually are surrounded by #, but they have a different syntax if they're nested. If this isn't it, then maybe look at nested variables: https://docs.rainmeter.net/manual/variables/nesting-variables/
Re: Referencing to a variable using a variable in its name :/
Hi and thanks,
Yeah, I looked into these, but didn't get to something working. Also your suggestion can't work here.
I want to set z to the value of any x1-x20, whereas the number to be picked is the y variable.(There's no y1 or y2)
So the used syntax cannot include a specific x1 or x13...
Yeah, I looked into these, but didn't get to something working. Also your suggestion can't work here.
I want to set z to the value of any x1-x20, whereas the number to be picked is the y variable.(There's no y1 or y2)
So the used syntax cannot include a specific x1 or x13...
Re: Referencing to a variable using a variable in its name :/
What's the use case?
Also, I'm kind of slow so if, for example, y=20 then x=20 and then z=2020??
Also, I'm kind of slow so if, for example, y=20 then x=20 and then z=2020??
Re: Referencing to a variable using a variable in its name :/
Nope, example:
x1=5
x2=345
x3=65
x4=111
etc... these are user variables in an .inc file.
When y=3, I want to set z to the value of x3, when y=1 i want to set z to the value of x1.
x1=5
x2=345
x3=65
x4=111
etc... these are user variables in an .inc file.
When y=3, I want to set z to the value of x3, when y=1 i want to set z to the value of x1.
Re: Referencing to a variable using a variable in its name :/
Then I'm pretty sure you're going to have to use IfConditions...
or
Should work in theory, but it's very late so I didn't test it. Also, if this has to be dynamic, I'd probably find a way to "merge" x and y if possible (though it might not be)
Code: Select all
[MeasureY]
Measure=Calc
Formula=#y#
IfCondition=MeasureY=1
IfTrueAction=[!SetVariable z x[MeasureY]]
Code: Select all
IfTrueAction=[!SetVariable z x#y#]
Re: Referencing to a variable using a variable in its name :/
Yeah, I'm also afraid I'll have to go the long way...
Thanks anyway, have a nice eve.
Thanks anyway, have a nice eve.
- Active Colors
- Moderator
- Posts: 1251
- Joined: February 16th, 2012, 3:32 am
- Location: Berlin, Germany
- Contact:
Re: Referencing to a variable using a variable in its name :/
Pflosch,
Like Halloyo said you would rather need here to use Nesting Variables.
If I got you right what you want to achive will look like this:
[!SetVariable z [#X[#Y]]]
Works for me:
Like Halloyo said you would rather need here to use Nesting Variables.
If I got you right what you want to achive will look like this:
[!SetVariable z [#X[#Y]]]
Works for me:
Re: Referencing to a variable using a variable in its name :/
Wow, I tried every syntax of nesting I could figure, didn't come to that.
Was fiddling around an hour or so....
Thanks heaps, thatz x-actly it YMMD
Was fiddling around an hour or so....
Thanks heaps, thatz x-actly it YMMD
- Active Colors
- Moderator
- Posts: 1251
- Joined: February 16th, 2012, 3:32 am
- Location: Berlin, Germany
- Contact: