Hi, I am new to Rainmeter. I am making a skin for my personal use and I don't know how to deal with the following problem.
I have three variables, first one is named 'size', which changes dynamically by scrolling the mouse. I want to change the second (name: W) and third (name: Gap) variables with an if condition depending on the first variable. Changes should be done by following values:
Asper the image If 'size' is 5.5, 'W' should be 6 and 'Gap' should be 5 and if 'size' is 2, 'W' should be 2 and 'Gap' should be 2.
Please help with how to change the second and third variables if the first one changes.
Thanks in advance.
It is currently October 13th, 2024, 4:52 pm
Change Variable dynamically with if function
-
- Posts: 28
- Joined: April 18th, 2023, 1:55 pm
Change Variable dynamically with if function
You do not have the required permissions to view the files attached to this post.
-
- Rainmeter Sage
- Posts: 2746
- Joined: March 23rd, 2015, 5:26 pm
Re: Change Variable dynamically with if function
You might want to read the manual. To answer your questions, you'll want to read about IfConditions and the !SetVariable bang.
You'll need to use these in conjunction with some measure that will react to whatever you are doing. The IfCondition docs have an example that uses !SetOption bangs, so you would do something similar using !SetVariable bangs instead.
-
- Rainmeter Sage
- Posts: 16651
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Change Variable dynamically with if function
There is a small inconsistency in the provided data. What should you get for both functions, when size=1? Because both functions are shown should be 2 when size is 1 on the 10th column, but should be 1 on the 12th column. Plase let us (me) know what value should the function return for size=1, because it matters a lot.
-
- Posts: 28
- Joined: April 18th, 2023, 1:55 pm
Re: Change Variable dynamically with if function
Please ignore the previous attached image. There are errors in the image and I am sorry for that.There is a small inconsistency in the provided data. What should you get for both functions, when size=1? Because both functions are shown should be 2 when size is 1 on the 10th column, but should be 1 on the 12th column. Plase let us (me) know what value should the function return for size=1, because it matters a lot.
Please check the new image. Asper the image If 'size' is 5.5, 'W' should be 6 and 'Gap' should be 5 and if 'size' is 2, 'W' should be 2 and 'Gap' should be 2. Accordingly when size=1 'W' and 'Gap' both should be 1.
You do not have the required permissions to view the files attached to this post.
-
- Rainmeter Sage
- Posts: 16651
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Change Variable dynamically with if function
There is no need of conditions. This can be done easily using the Floor and Ceil functions. For instance:Tezz95 wrote: ↑April 20th, 2023, 2:25 am Please ignore the previous attached image. There are errors in the image and I am sorry for that.
Please check the new image.Screenshot 2023-04-20 073832.png
Asper the image If 'size' is 5.5, 'W' should be 6 and 'Gap' should be 5 and if 'size' is 2, 'W' should be 2 and 'Gap' should be 2. Accordingly when size=1 'W' and 'Gap' both should be 1.
Code: Select all
[Variables]
size=1
[MeasureW]
Measure=Calc
Formula=( Ceil ( #size# ))
[MeasureGap]
Measure=Calc
Formula=( Floor ( #size# ))
-
- Posts: 28
- Joined: April 18th, 2023, 1:55 pm
-
- Rainmeter Sage
- Posts: 16651
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Change Variable dynamically with if function
Great! There always are many things to be learnt.