Hi! I'm making basic musicplayer a skin, but since i use spotify, rainmeter doesn't know if it's playing or not. I'm trying to make the button switch between a pause and play texture, but i dont know how to switchthe variable. Is there a way to make !SetVariable check first before setting it?
tl;dr i need help making a bang do "if var = 0, set var to 1. if var = 1, set var to 0," thank you!
It is currently April 20th, 2024, 6:39 am
Switch between two variables in bangs
-
- Posts: 1
- Joined: March 26th, 2020, 9:27 pm
-
- Posts: 110
- Joined: February 23rd, 2018, 3:12 am
- Location: United States
Re: Switch between two variables in bangs
Depending on what you want the variable to start on, Make it's value the opposite. So if you wanted it to be 1:
Then toggle between 1 and zero with:
You can name the variable whatever you want (within reason)
Code: Select all
ToggleMe=0
Code: Select all
LeftMouseDownAction=[!SetVariable ToggleMe (1-#ToggleMe#)]
Code: Select all
LeftMouseUpAction=[!Bang to play music]
Never underestimate the power of stupid!
-
- Rainmeter Sage
- Posts: 16148
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Switch between two variables in bangs
Additionally note that you have to set on the dynamic variables on every measure or meter where you wanna use the dynamically set variable (in this case ToggleMe), by adding a DynamicVariables=1 option to that measure or meter. This has to be done even on the meter where the above LeftMouseDownAction is set on.
One more: not a too good idea to use LeftMouseDownAction on the meter, unless there is another reason to do this. I'd add both bangs to the LeftMouseUpAction.