It is currently May 3rd, 2024, 3:38 am

how do I toggle between 2 variables on LeftMouseDown action?

Get help with creating, editing & fixing problems with skins
Imaginos
Posts: 15
Joined: October 5th, 2011, 3:21 pm

how do I toggle between 2 variables on LeftMouseDown action?

Post by Imaginos »

Hi there everyone!

I'm trying to change a variable to toggle an animation (single frames in a directory) on and off. I figured the way to do this was to make the counting calculation a variable and have it set to either 1, so it shows frame 1 only and doesn't count, or 28 where it will then count to 28 and play the animation.

The problem is I can't figure out how to write the LeftMouseDown action to toggle between the 2 variables/states, or to change the 1 variable back and forth. Spent a few hours messing with it and my brain is now mush. HELP!

Thank you
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: how do I toggle between 2 variables on LeftMouseDown act

Post by smurfier »

LeftMouseUpAction=!SetVariable YourVariable (29-#YourVariable#)
DynamicVariables=1

If you want to toggle between 1 and 28, just add them together and subtract the current value of your variable.

You may benefit from this thread.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
Imaginos
Posts: 15
Joined: October 5th, 2011, 3:21 pm

Re: how do I toggle between 2 variables on LeftMouseDown act

Post by Imaginos »

smurfier wrote:LeftMouseUpAction=!SetVariable YourVariable (29-#YourVariable#)
DynamicVariables=1

If you want to toggle between 1 and 28, just add them together and subtract the current value of your variable.

You may benefit from this thread.
Yes I'd like to have them toggle per mouse click, so 1 Click would set 28 and another click would set 1. I don't understand your code there fully but will give it a try and will check out that thread.

Thank you for the fast reply!
Imaginos
User avatar
killall-q
Posts: 305
Joined: August 14th, 2009, 8:04 am

Re: how do I toggle between 2 variables on LeftMouseDown act

Post by killall-q »

Here's that code in a quickie test skin.

Code: Select all

[Rainmeter]

[Variables]
YourVariable=28

; ----------------METERS----------------

[MeterText]
Meter=STRING
FontColor=255, 255, 255
FontSize=36
SolidColor=0, 0, 0, 160
AntiAlias=1
DynamicVariables=1
Text="#YourVariable#"
LeftMouseUpAction=!SetVariable YourVariable (29-#YourVariable#)
Imaginos
Posts: 15
Joined: October 5th, 2011, 3:21 pm

Re: how do I toggle between 2 variables on LeftMouseDown act

Post by Imaginos »

Heh, thanks... I see. The variable code takes both numbers added together and then subtracts one of the two from that total, giving you one of the two numbers. Tricky and nice! :)

Thank you again for the code/help/thread link.