It is currently April 30th, 2024, 8:40 am

Simple countdown timer

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16189
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Simple countdown timer

Post by balala »

sl23 wrote: August 1st, 2021, 10:08 pm Basically, a refresh makes #CloseApps# work fine. If I click any other Button#, again it works fine and Hibernates, Shutdown or Locks the PC, but click on Button1 to set the Variable back to #CloseApps# and it doesn't change. What this means is that whatever was clicked last, say, Button4 #Lock#, remains as the Variable when clicking Button1. Even though Button1 is clearly stated as #CloseApps#. WTF? :twisted:
The topic in meantime got large enough, so I'm not entirely sure you got a solution, but if you didn't here is is.
This is caused by quotes. In the CloseApps variable (as defined into the [Variables] section) you have quoted the Run parameter (CloseApps=!CommandMeasure mClose "Run"). When you want to set the Act variable into the LeftMouseUpAction option of the [Button1] meter, you quoted again the #CloseApps# variable. Those quotes confuse Rainmeter.
The solution is quite easy: remove the quotes from the Run parameter of the CloseApps variable (CloseApps=!CommandMeasure mClose Run). They are not needed, you can easily get rid of them. The other buttons are working, because there are no quotes in the other variables (Hibernate, Shutdown or Lock).
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Simple countdown timer

Post by death.crafter »

sl23 wrote: August 2nd, 2021, 9:16 am EDIT: One other thing, how did you get the images for Play, Pause and Reset? Really like those ;-)
They are symbol fonts installed by default. Segoe MDL2 Assets.

You can look at Play, Pause and Reset buttons to know how to use them.

Now about Yin's formulas:
  • He uses $MouseX$ conditional to know where you are scrolling and according to that:
    • Hour: Adds 3600
    • Minute: Adds 60
    • Second: Adds 1
  • Then he clamps the value to a min: 0 and a max: (99*3600+59*60+59)(1 sec less than 100)
  • Well that's all he does, but with a major flaw. If you scroll down on hour when it's 00, the timer will go back to 00:00 00.
But knowing him, he can easily come up with an even longer formula to overcome this :rolmfao:
from the Realm of Death
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

balala wrote: August 2nd, 2021, 10:08 am The topic in meantime got large enough, so I'm not entirely sure you got a solution, but if you didn't here is is.
This is caused by quotes. In the CloseApps variable (as defined into the [Variables] section) you have quoted the Run parameter (CloseApps=!CommandMeasure mClose "Run"). When you want to set the Act variable into the LeftMouseUpAction option of the [Button1] meter, you quoted again the #CloseApps# variable. Those quotes confuse Rainmeter.
The solution is quite easy: remove the quotes from the Run parameter of the CloseApps variable (CloseApps=!CommandMeasure mClose Run). They are not needed, you can easily get rid of them. The other buttons are working, because there are no quotes in the other variables (Hibernate, Shutdown or Lock).
Wow so easy when you know! It's hard knowing when they are needed and when not. Thank you for putting me out of my misery, it was driving me nuts :? :lol:
- MuLab -
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

death.crafter wrote: August 2nd, 2021, 11:38 am They are symbol fonts installed by default. Segoe MDL2 Assets.

You can look at Play, Pause and Reset buttons to know how to use them.

Now about Yin's formulas:
  • He uses $MouseX$ conditional to know where you are scrolling and according to that:
    • Hour: Adds 3600
    • Minute: Adds 60
    • Second: Adds 1
  • Then he clamps the value to a min: 0 and a max: (99*3600+59*60+59)(1 sec less than 100)
  • Well that's all he does, but with a major flaw. If you scroll down on hour when it's 00, the timer will go back to 00:00 00.
But knowing him, he can easily come up with an even longer formula to overcome this :rolmfao:
Excellent to know, thanks for the link :D
It's not too bad a flaw, so think I can live with that.
- MuLab -
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

Another curiosity... Why have many of the Variables only one # at the start?

Code: Select all

MaxValue=([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)
I thought they needed two, one at the start and one at the end? Like the next line in the code:

Code: Select all

IfCondition=(#CURRENTSECTION#<=0) && (Sgn(#Direction#)=-1)
- MuLab -
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Simple countdown timer

Post by death.crafter »

sl23 wrote: August 2nd, 2021, 11:59 am Another curiosity... Why have many of the Variables only one # at the start?

Code: Select all

MaxValue=([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)
I thought they needed two, one at the start and one at the end? Like the next line in the code:

Code: Select all

IfCondition=(#CURRENTSECTION#<=0) && (Sgn(#Direction#)=-1)
https://docs.rainmeter.net/manual-beta/variables/nesting-variables/
from the Realm of Death
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

Er, ok lol took me a while to get my head around Variables, now there are Nested Variables! :jawdrop
- MuLab -
User avatar
Yincognito
Rainmeter Sage
Posts: 7184
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Simple countdown timer

Post by Yincognito »

death.crafter wrote: August 2nd, 2021, 11:38 amNow about Yin's formulas:
  • He uses $MouseX$ conditional to know where you are scrolling and according to that:
    • Hour: Adds 3600
    • Minute: Adds 60
    • Second: Adds 1
  • Then he clamps the value to a min: 0 and a max: (99*3600+59*60+59)(1 sec less than 100)
Correct. It's actually $MouseX:%$, because then you don't depend on knowing the exact pixels and you can play with more or less approximate percents. These will still depend on the font characteristics and spacing, so if there is a flaw to it, this is it. It's not a big one though, and since sl23 refused the resizing feature, I reckon he won't dynamically change fonts every time the skin is running, so it's a "calculated risk", if you like.
death.crafter wrote: August 2nd, 2021, 11:38 am
  • Well that's all he does, but with a major flaw. If you scroll down on hour when it's 00, the timer will go back to 00:00 00.
Actually, that's more or less intentional, and a very nice side effect, IMHO. But then, since you don't like the minute changing to the next when the seconds get past 60, the fact that you don't like this effect either goes without saying. :p
death.crafter wrote: August 2nd, 2021, 11:38 amBut knowing him, he can easily come up with an even longer formula to overcome this :rolmfao:
Says the one who comes up with a (non Rainmeter native) script for everything. :rolmfao:
But it's a nice one, I'll give you that, and sometimes (I try very hard to avoid it, you know) probably true. :oops:

What can I say ... at least I overcome stuff, right? 8-) No pain, no gain. :confused:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7184
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Simple countdown timer

Post by Yincognito »

sl23 wrote: August 2nd, 2021, 12:31 pm Er, ok lol took me a while to get my head around Variables, now there are Nested Variables! :jawdrop
In this specific case, there are only a few places where you need the nested syntax (I'm talking about my code now, as death.crafter has a soft spot for them, LOL), and it's basically when you use the modified value of a variable you just altered ... in the same option, like here:

Code: Select all

MouseScrollUpAction=[!SetVariable DefaultSeconds (Clamp((#DefaultSeconds#+($MouseX:%$<38?3600:($MouseX:%$<76?60:1))),0,(99*3600+59*60+59)))][!SetVariable Seconds [#DefaultSeconds]]...
So I alter DefaultSeconds but then I need its updated value right away, in the same option. There is no measure update to update it for me, so I have to tell Rainmeter to give me the altered variable's "new value" instead of its "old", unaltered one.

P.S. I'm ok with the old value in the Clamp() formula, so I keep the classic syntax there.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Simple countdown timer

Post by death.crafter »

Yincognito wrote: August 2nd, 2021, 12:52 pm Actually, that's more or less intentional, and a very nice side effect, IMHO. But then, since you don't like the minute changing to the next when the seconds get past 60, the fact that you don't like this effect either goes without saying. :p
I set the timer on 00:29 58.

By mistake I scrolled on 00.
HamsterPlayingGIF.gif
Yincognito wrote: August 2nd, 2021, 12:52 pm Says the one who comes up with a (non Rainmeter native) script for everything. :rolmfao:
But it's a nice one, I'll give you that, and sometimes (I try very hard to avoid it, you know) probably true. :oops:

What can I say ... at least I overcome stuff, right? 8-) No pain, no gain. :confused:
LMAO.

The stress was on a longer formula :rofl: btw.
You do not have the required permissions to view the files attached to this post.
from the Realm of Death