It is currently April 27th, 2024, 7:47 am

Tryimg to make a simple timer that resets to zero - so far: weirdness

Get help with creating, editing & fixing problems with skins
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Tryimg to make a simple timer that resets to zero - so far: weirdness

Post by CodeCode »

I have potted together some code.

It is supposed to be a time counter of time since 'zero' (now)

I have gotten to the part where the counter is showing both the current time and the timer alternating very second or two, The icon simply paused the countdown and stopping and resetting are hopeflu additions in the future.


Here is the rmskin since there is an image and a font;
Timer_xb.rmskin
Obviously the current time is a weird side effect of the code being wrong, but when I change anything to goes back to showing the current time.

Any help is appreciated.
You do not have the required permissions to view the files attached to this post.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
balala
Rainmeter Sage
Posts: 16175
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Tryimg to make a simple timer that resets to zero - so far: weirdness

Post by balala »

CodeCode wrote: March 1st, 2024, 3:39 pm Any help is appreciated.
Help related to what? What is your question, what would you like to achieve, because for me at least it's not clear at all?
RicardoTM
Posts: 268
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Tryimg to make a simple timer that resets to zero - so far: weirdness

Post by RicardoTM »

Sorry I haven't checked your code, but for time the best is to use time measures instead of counters. Check this skin in this thread
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Tryimg to make a simple timer that resets to zero - so far: weirdness

Post by CodeCode »

balala wrote: March 1st, 2024, 3:53 pm Help related to what? What is your question, what would you like to achieve, because for me at least it's not clear at all?
Like I said, I am trying to make a timer that measures time transpired.

My code does that but it also keeps alternating between current time and time elapsed from last refresh.

O would like it to only showtime transpired.

Thanks.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Tryimg to make a simple timer that resets to zero - so far: weirdness

Post by CodeCode »

RicardoTM wrote: March 1st, 2024, 3:55 pm Sorry I haven't checked your code, but for time the best is to use time measures instead of counters. Check this skin in this thread
Thanks. But that is way too complicated for my need.

It would take longer to suss out that code than to start from scratch as I have tried to do.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
balala
Rainmeter Sage
Posts: 16175
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Tryimg to make a simple timer that resets to zero - so far: weirdness

Post by balala »

CodeCode wrote: March 1st, 2024, 4:03 pm O would like it to only showtime transpired.
But why are you complicating thing so much, in this case? I mean that if you want to get only the time transpired, use some simple measures, which are returning only the needed things. For instance:

Code: Select all

[MeasureStart]
Measure=Time
UpdateDivider=-1

[MeasureTime]
Measure=Time
Paused=1

[MeasureTimeTranspired]
Measure=Calc
Formula=( [MeasureTime:TimeStamp] - [MeasureStart:TimeStamp] )
DynamicVariables=1
[MeasureTimeTranspired] return the needed information, in seconds. At refresh it starts with 0 and to get it starting you need a simple mouse action (for example), like this one: LeftMouseUpAction=[!UnpauseMeasure "MeasureStart"][!UpdateMeasure "MeasureStart"][!UnpauseMeasure "MeasureTime"][!PauseMeasure "MeasureStart"]. This way the MeasureName option of the [MeterUptime] meter should be: MeasureName=MeasureTimeTranspired.
If you want to get the counting starting on the refresh, you simply have to remove the Paused=1 option of the [MeasureTime] measure. And finally if you need the time gone since the refresh in a formated way, you can get it through an Uptime measure.
Isn't this a much more proper (or better, or simpler) approach?
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Tryimg to make a simple timer that resets to zero - so far: weirdness

Post by CodeCode »

balala wrote: March 1st, 2024, 4:38 pm But why are you complicating thing so much, in this case? I mean that if you want to get only the time transpired, use some simple measures, which are returning only the needed things. For instance:

Code: Select all

[MeasureStart]
Measure=Time
UpdateDivider=-1

[MeasureTime]
Measure=Time
Paused=1

[MeasureTimeTranspired]
Measure=Calc
Formula=( [MeasureTime:TimeStamp] - [MeasureStart:TimeStamp] )
DynamicVariables=1
[MeasureTimeTranspired] return the needed information, in seconds. At refresh it starts with 0 and to get it starting you need a simple mouse action (for example), like this one: LeftMouseUpAction=[!UnpauseMeasure "MeasureStart"][!UpdateMeasure "MeasureStart"][!UnpauseMeasure "MeasureTime"][!PauseMeasure "MeasureStart"]. This way the MeasureName option of the [MeterUptime] meter should be: MeasureName=MeasureTimeTranspired.
If you want to get the counting starting on the refresh, you simply have to remove the Paused=1 option of the [MeasureTime] measure. And finally if you need the time gone since the refresh in a formated way, you can get it through an Uptime measure.
Isn't this a much more proper (or better, or simpler) approach?
UNdterstandible simpler, but the time is not in H : M : S format just seconds.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
balala
Rainmeter Sage
Posts: 16175
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Tryimg to make a simple timer that resets to zero - so far: weirdness

Post by balala »

CodeCode wrote: March 1st, 2024, 5:22 pm UNdterstandible simpler, but the time is not in H : M : S format just seconds.
Yep, but this is why sis I say you can use a Uptime measure, to get it formatted. For instance:

Code: Select all

[MeasureTimeTranspiredForm]
Measure=Uptime
Format=%3!02i! : %2!02i! : %1!02i!
SecondsValue=[MeasureTimeTranspired]
DynamicVariables=1
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Tryimg to make a simple timer that resets to zero - so far: weirdness

Post by CodeCode »

Thanks for that. I am a stereotypical overcomplicatidist.

Gracias, abrigado, origato, much appreciated.
:rosegift:
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
balala
Rainmeter Sage
Posts: 16175
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Tryimg to make a simple timer that resets to zero - so far: weirdness

Post by balala »

CodeCode wrote: March 1st, 2024, 6:03 pm Thanks for that. I am a stereotypical overcomplicatidist.
Great! And don't be, at least when possible. :great: