It is currently April 27th, 2024, 9:21 am

help with time counter

Get help with creating, editing & fixing problems with skins
User avatar
CarlotaN
Posts: 50
Joined: December 5th, 2022, 3:45 am
Location: Madrid, Spain

help with time counter

Post by CarlotaN »

Hello, I need help.
First of all sorry for the translation of Saint Google.

This Chronometer works perfectly as a WATCH, but not as a TIME COUNTER.
The problem is that the line does not start at 0 and after the pause, it continues in the real seconds.
The seconds are synchronized with the time and not as a time counter.
I have tried a thousand ways, but I can't find the solution. Is it possible to convert it into a stopwatch that is not a countdown?
I have also tried with other code, which starts at 0, but the timeline is sometimes exact and other times it is unbalanced.

If anyone could help me, that would be fantastic. Thank you. :rosegift:

Code: Select all

[Rainmeter]
Update=60
AccurateText=1
Background=#@#Images\cronos.png
MiddleMouseDownAction=!Refresh
OnRefreshAction=[!DisableMeasure MeasureTimeDelta][!DisableMeasure MeasureBar][!HideMeter "StopButton"][!HideMeter "PauseButton"][!ShowMeter "StartButton"]

;-------------------------------------------------------------

[Metadata]
Name=SweepSeconds + Timer Monterey
Author=JSMorley, Creewick... y más que no me acuerdo... y algo de mi.
Information=Cronómetro. Basado en SweepSeconds y Timer Monterey
License=Creative Commons Share-Alike NC 4

;-------------------------------------------------------------

[Variables]

StartTime=-1
EndTime  =-1
PauseTime=-1

ActionPlay=[!EnableMeasure MeasureTimeDelta][!UnpauseMeasure TimeLeft][!EnableMeasure MeasureElapsedTime][!ShowMeter "StopButton"][!Redraw]
ActionPause=[!DisableMeasure MeasureTimeDelta][!PauseMeasure TimeLeft][!PauseMeasure MeasureElapsedTime][!Redraw]

[TextStyle]
FontFace=Garamond
FontColor=644b40
FontSize=16
StringEffect=Shadow
FontEffectColor=fdfceb
StringStyle=Bold
StringAlign=CenterCenter
AntiAlias=1
X=70

[sController]
W=24
H=24
MouseOverAction=[!SetOption "#CurrentSection#" ImageTint DDDDDD][!UpdateMeter #CurrentSection#][!Redraw]
MouseLeaveAction=[!SetOption "#CurrentSection#" ImageTint ""][!UpdateMeter #CurrentSection#][!Redraw]

;-------------------------------------------------------------
;[MEDIDORES Y SCRIPT]
;-------------------------------------------------------------

[Lua]
Measure=Script
ScriptFile=#@#Scripts\Timer.lua

[IsStopped]
Group=Measures
Measure=Calc
Formula=(#StartTime# = -1)
DynamicVariables=1

[IsPaused]
Group=Measures
Measure=Calc
Formula=(#PauseTime# <> -1)
DynamicVariables=1

[IsStarted]
Group=Measures
Measure=Calc
Formula=(#StartTime# <> -1) && (#PauseTime# = -1)
DynamicVariables=1

[TrueNow]
Measure=Time
UpdateDivider=1

[TheClock]
Group=Measures
Measure=Time
DynamicVariables=1
Format=🔔 %H:%M

;-------------------------------------------------------------
;[ELIPSE PERCENTUAL]
;-------------------------------------------------------------

[TimeMeterBase]
Meter=Shape
Shape=Ellipse 0,0,56,56 | Fill Color 00000000 | StrokeWidth 4 | Stroke Color 2C2C2C
X=70
Y=70

[TimeLeft]
Group=Measures
Measure=Time
Format=%#S
AverageSize=10
Disabled=([IsStopped] = 1) 
DynamicVariables=1

[MeasureBar]
Measure=Calc
Formula=(TimeLeft % 59) / 60

;-------------------------------------------------------------
;[LINEA DE TIEMPO]
;-------------------------------------------------------------

[MeterSeconds]
Group=Meters
Meter=Roundline
MeasureName=MeasureBar
X=r
Y=r
StartAngle=(-PI/2)
RotationAngle=(2*PI)
LineStart=54
LineLength=58
LineColor=f9932e
Solid=1
AntiAlias=1
Hidden=([IsStopped] = 1)
DynamicVariables=1
UpdateDivider=1

;-------------------------------------------------------------
;[CONTADORES DE TIEMPO]
;-------------------------------------------------------------

[MeasureCurrentTime]
Group=Measures
Measure=Time

[MeasureTimeDelta]
Group=Measures
Measure=Calc
Formula=(MeasureTimeDelta = 0 ? (MeasureCurrentTime - MeasureElapsedTime / 10) : MeasureTimeDelta)
Disabled=1

[MeasureElapsedTime]
Group=Measures
Measure=Calc
Formula=(MeasureTimeDelta = 0 ? MeasureElapsedTime : (MeasureCurrentTime - MeasureTimeDelta) * 10)

[CalcElapsedHours]
Group=Meters
Measure=Calc
Formula=Floor(MeasureElapsedTime / 10 / 3600) % 24
RegExpSubstitute=1
Substitute="(.+)":"0\1","^\d(\d\d)$":"\1"

[CalcElapsedMinutes]
Group=Meters
Measure=Calc
Formula=Floor(MeasureElapsedTime / 10 / 60) % 60
RegExpSubstitute=1
Substitute="(.+)":"0\1","^\d(\d\d)$":"\1"

[CalcElapsedSeconds]
Group=Meters
Measure=Calc
Formula=Floor(MeasureElapsedTime / 10) % 60
RegExpSubstitute=1
Substitute="(.+)":"0\1","^\d(\d\d)$":"\1"

;-------------------------------------------------------------
;[TIEMPO]
;-------------------------------------------------------------

[VisibleTime]
Group=Measures
Meter=String
MeasureName=CalcElapsedHours
MeasureName2=CalcElapsedMinutes
MeasureName3=CalcElapsedSeconds
MeterStyle=TextStyle
NumOfDecimals=0
Y=60
Text="%1:%2:%3"

;-------------------------------------------------------------
;[RELOJ]
;-------------------------------------------------------------

[TimeMeter]
Group=Meters
MeasureName=TheClock
Meter=String
MeterStyle=TextStyle
FontSize=9
Text=
Y=80
Hidden=([IsStopped] = 1)

;-------------------------------------------------------------
;[BOTONES]
;-------------------------------------------------------------

[StopButton]
Meter=Image
Group=Meters
ImageName=#@#Images\istop.png
MeterStyle=sController
X=59
Y=25
LeftMouseUpAction=[&Lua:stop()][!SetOption MeterPlayPause ImageName "#@#Botones\iplay.png"][!DisableMeasure MeasureTimeDelta][!Redraw]
Hidden=([IsStopped] = 1)
DynamicVariables=1

[StartButton]
Group=Meters
Meter=Image
ImageName=#@#Images\iplay.png
MeterStyle=sController
X=r
Y=90
LeftMouseUpAction=[&Lua:continue()]#ActionPlay#[!Delay "0"][!ShowMeter "PauseButton"][!EnableMeasure MeasureBar]
Hidden=([IsStopped] = 0)
DynamicVariables=1

[PauseButton]
Group=Meters
Meter=Image
ImageName=#@#Images\ipause.png
MeterStyle=sController
X=r
Y=r
LeftMouseUpAction=[&Lua:pause()]#ActionPause#
Hidden=([IsStarted] = 0)
DynamicVariables=1

[ContinueButton]
Group=Meters
Meter=Image
ImageName=#@#Images\iplay.png
MeterStyle=sController
X=r
Y=r
LeftMouseUpAction=[&Lua:continue()]#ActionPlay#[!Delay "0"][!ShowMeter "PauseButton"]
Hidden=([IsPaused] = 0)
DynamicVariables=1
Script included:

Code: Select all

function start()
    local now = SKIN:GetMeasure('TrueNow'):GetValue()

    setAndSave('StartTime', now)

    local duration = SKIN:GetVariable('VisibleTime', 0)
    local endTime = now + duration

    setAndSave('EndTime', endTime)

    SKIN:Bang('!SetOption', 'Now', 'AverageSize', 10)

    update()
    return 0
end

function pause()
    local now = SKIN:GetMeasure('TrueNow'):GetValue()
    
    setAndSave('PauseTime', now)

    SKIN:Bang('!SetOption', 'Now', 'AverageSize', 1)

    update()
    return 0
end

function continue()
    local now = SKIN:GetMeasure('TrueNow'):GetValue()
    local pauseTime = SKIN:GetVariable('PauseTime', 0)
    local startTime = SKIN:GetVariable('StartTime', 0)
    local endTime = SKIN:GetVariable('EndTime', 0)
 
    local newStartTime = now - pauseTime + startTime
    setAndSave('StartTime', newStartTime)

    local newEndTime = now - pauseTime + endTime
    setAndSave('EndTime', newEndTime)
    setAndSave('PauseTime', -1)

    SKIN:Bang('!SetOption', 'Now', 'AverageSize', 10)

    update()
    return 0
end

function stop()
    SKIN:Bang('PlayStop')
    setAndSave('StartTime', -1)
    setAndSave('EndTime', -1)
    setAndSave('PauseTime', -1)
    
    SKIN:Bang('!Refresh')
    return 0
end

function increase(type, value)
    if (type == 'h') then value = value * 60 * 60 end
    if (type == 'm') then value = value * 60 end

    local time = SKIN:GetVariable('VisibleTime')
    SKIN:Bang('!SetVariable', 'VisibleTime', math.min(math.max(time + value, 0), 24 * 60 * 60 - 1))
    return 0
end

function input(type, value)
    local time = SKIN:GetVariable('VisibleTime')
    local seconds = time % 60
    local minutes = ((time - seconds) / 60) % 60
    local hours = (time - seconds - minutes * 60) / (60 * 60)

    if (type == 'h') then 
        time = time + (value - hours) * 60 * 60
    end
    if (type == 'm') then 
        time = time + (value - minutes) * 60
    end
    if (type == 's') then
        time = time + (value - seconds)
    end

    SKIN:Bang('!SetVariable', 'VisibleTime', math.min(math.max(time, 0), 24 * 60 * 60 - 1))
    return 0
end

function setAndSave(variable, value)
    SKIN:Bang('!WriteKeyValue', 'Variables', variable, value)
    SKIN:Bang('!SetVariable', variable, value)
end

function update()
    SKIN:Bang('!UpdateMeasureGroup', 'Measures')
    SKIN:Bang('!UpdateMeterGroup', 'Meters')
end
Image
User avatar
CarlotaN
Posts: 50
Joined: December 5th, 2022, 3:45 am
Location: Madrid, Spain

Re: help with time counter

Post by CarlotaN »

The other code that works as a counter, but is decompensated, is this

Code: Select all

[Rainmeter]
Update=60
AccurateText=1
Background=#@#Images\cronos.png
MiddleMouseDownAction=!Refresh
OnRefreshAction=[!DisableMeasure MeasureTimeDelta][!DisableMeasure MeasureBar][!HideMeter "StopButton"][!HideMeter "PauseButton"][!ShowMeter "StartButton"]

;-------------------------------------------------------------

[Metadata]
Name=SweepSeconds + Timer Monterey
Author=JSMorley, Creewick... y más que no me acuerdo... y algo de mi.
Information=Cronómetro. Basado en SweepSeconds y Timer Monterey
License=Creative Commons Share-Alike NC 4

;-------------------------------------------------------------

[Variables]

StartTime=-1
EndTime  =-1
PauseTime=-1
RoundLineSeconds=600

ActionPlay=[!EnableMeasure MeasureTimeDelta][!UnpauseMeasure TimeLeft][!EnableMeasure MeasureElapsedTime][!ShowMeter "StopButton"][!Redraw]
ActionPause=[!DisableMeasure MeasureTimeDelta][!PauseMeasure TimeLeft][!PauseMeasure MeasureElapsedTime][!Redraw]

[TextStyle]
FontFace=Garamond
FontColor=644b40
FontSize=16
StringEffect=Shadow
FontEffectColor=fdfceb
StringStyle=Bold
StringAlign=CenterCenter
AntiAlias=1
X=70

[sController]
W=24
H=24
MouseOverAction=[!SetOption "#CurrentSection#" ImageTint DDDDDD][!UpdateMeter #CurrentSection#][!Redraw]
MouseLeaveAction=[!SetOption "#CurrentSection#" ImageTint ""][!UpdateMeter #CurrentSection#][!Redraw]

;-------------------------------------------------------------
;[MEDIDORES Y SCRIPT]
;-------------------------------------------------------------

[Lua]
Measure=Script
ScriptFile=#@#Scripts\Timer.lua

[IsStopped]
Group=Measures
Measure=Calc
Formula=(#StartTime# = -1)
DynamicVariables=1

[IsPaused]
Group=Measures
Measure=Calc
Formula=(#PauseTime# <> -1)
DynamicVariables=1

[IsStarted]
Group=Measures
Measure=Calc
Formula=(#StartTime# <> -1) && (#PauseTime# = -1)
DynamicVariables=1

[TrueNow]
Measure=Time
UpdateDivider=1

[TheClock]
Group=Measures
Measure=Time
DynamicVariables=1
Format=🔔 %H:%M

[TimeLeft]
Group=Measures
Measure=Calc
Formula=([TimeLeft]%#RoundLineSeconds#)+1
Disabled=([IsStopped] = 1) 
DynamicVariables=1
UpdateDivider=1

;-------------------------------------------------------------
;[ELIPSE PERCENTUAL]
;-------------------------------------------------------------

[MeasureBar]
Group=Measures
Measure=Calc
Formula=TimeLeft / (#RoundLineSeconds#+1)

[TimeMeterBase]
Meter=Shape
Shape=Ellipse 0,0,56,56 | Fill Color 00000000 | StrokeWidth 5 | Stroke Color 2C2C2C
X=70
Y=70

;-------------------------------------------------------------
;[LINEA DE TIEMPO]
;-------------------------------------------------------------

[TimeMeter]
Group=Meters
Meter=Roundline
MeasureName=MeasureBar
StartAngle=(-PI/2)
LineColor=f9932e
LineStart=54
LineLength=58
Solid=1
AntiAlias=1
X=r
Y=r
Hidden=([IsStopped] = 1)
DynamicVariables=1
UpdateDivider=1

;-------------------------------------------------------------
;[CONTADORES DE TIEMPO]
;-------------------------------------------------------------

[MeasureCurrentTime]
Group=Measures
Measure=Time
AverageSize=10

[MeasureTimeDelta]
Group=Measures
Measure=Calc
Formula=(MeasureTimeDelta = 0 ? (MeasureCurrentTime - MeasureElapsedTime / 10) : MeasureTimeDelta)
Disabled=1

[MeasureElapsedTime]
Group=Measures
Measure=Calc
Formula=(MeasureTimeDelta = 0 ? MeasureElapsedTime : (MeasureCurrentTime - MeasureTimeDelta) * 10)

[CalcElapsedHours]
Group=Meters
Measure=Calc
Formula=Floor(MeasureElapsedTime / 10 / 3600) % 24
RegExpSubstitute=1
Substitute="(.+)":"0\1","^\d(\d\d)$":"\1"

[CalcElapsedMinutes]
Group=Meters
Measure=Calc
Formula=Floor(MeasureElapsedTime / 10 / 60) % 60
RegExpSubstitute=1
Substitute="(.+)":"0\1","^\d(\d\d)$":"\1"

[CalcElapsedSeconds]
Group=Meters
Measure=Calc
Formula=Floor(MeasureElapsedTime / 10) % 60
RegExpSubstitute=1
Substitute="(.+)":"0\1","^\d(\d\d)$":"\1"

;-------------------------------------------------------------
;[TIEMPO]
;-------------------------------------------------------------

[VisibleTime]
Group=Measures
Meter=String
MeasureName=CalcElapsedHours
MeasureName2=CalcElapsedMinutes
MeasureName3=CalcElapsedSeconds
MeterStyle=TextStyle
NumOfDecimals=0
Y=60
Text="%1:%2:%3"

;-------------------------------------------------------------
;[RELOJ]
;-------------------------------------------------------------

[EndTimeMeter]
MeasureName=TheClock
Group=Meters
Meter=String
MeterStyle=TextStyle
FontSize=9
Text=
Y=80
Hidden=([IsStopped] = 1)

;-------------------------------------------------------------
;[BOTONES]
;-------------------------------------------------------------

[StopButton]
Meter=Image
Group=Meters
ImageName=#@#Images\istop.png
MeterStyle=sController
X=59
Y=25
LeftMouseUpAction=[&Lua:stop()][!SetOption MeterPlayPause ImageName "#@#Images\iplay.png"][!DisableMeasure MeasureTimeDelta][!Redraw]
Hidden=([IsStopped] = 1)
DynamicVariables=1

[StartButton]
Group=Meters
Meter=Image
ImageName=#@#Images\iplay.png
MeterStyle=sController
X=r
Y=90
LeftMouseUpAction=[&Lua:continue()]#ActionPlay#[!Delay "0"][!ShowMeter "PauseButton"][!EnableMeasure MeasureBar]
Hidden=([IsStopped] = 0)
DynamicVariables=1

[PauseButton]
Group=Meters
Meter=Image
ImageName=#@#Images\ipause.png
MeterStyle=sController
X=r
Y=r
LeftMouseUpAction=[&Lua:pause()]#ActionPause#
Hidden=([IsStarted] = 0)
DynamicVariables=1

[ContinueButton]
Group=Meters
Meter=Image
ImageName=#@#Images\iplay.png
MeterStyle=sController
X=r
Y=r
LeftMouseUpAction=[&Lua:continue()]#ActionPlay#[!Delay "0"][!ShowMeter "PauseButton"]
Hidden=([IsPaused] = 0)
DynamicVariables=1
Thank you.
Image
User avatar
balala
Rainmeter Sage
Posts: 16176
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: help with time counter

Post by balala »

CarlotaN wrote: February 24th, 2024, 4:58 am First of all sorry for the translation of Saint Google.
Don't worry, this is definitely not a problem...
CarlotaN wrote: February 24th, 2024, 4:58 am This Chronometer works perfectly as a WATCH, but not as a TIME COUNTER.
The problem is that the line does not start at 0 and after the pause, it continues in the real seconds.
The seconds are synchronized with the time and not as a time counter.
Getting the "line" (in fact the roundline) not to be synchronized with the real seconds, is quite easy: you have to replace the [MeasureBar] measure by the following one:

Code: Select all

[MeasureBar]
Measure=Calc
Formula=(( MeasureBar + 1 ) % 600 )
MinValue=0
MaxValue=600
But unfortunately this is not a real fix, because this way the reoundline is starting always by 0 and fill up in one minute, however the pause doesn't work anymore. I should look little bit more in detail over the code to can find a fix, but first I should have to understand your intention, because I'm not sure I got what you want. So, question is what would you like to achieve. I think you would like to pause the roundline when you click the button, then, when click unpause would like to restart it. But should that roundline always count to 60 seconds? And it should count up or down?
So give us please few details. Also pack please the whole config and upload the package here, because the code uses lot of resources, which are needed in order to can properly work with it.
User avatar
CarlotaN
Posts: 50
Joined: December 5th, 2022, 3:45 am
Location: Madrid, Spain

Re: help with time counter

Post by CarlotaN »

Cronometro1.1.rmskin
Balala! My savior!!!
You just need to turn it around for a minute and restart.
I don't need it to be turning to the stop.

Thank you

PD: How can I upload the files?

Ya!
You do not have the required permissions to view the files attached to this post.
Last edited by CarlotaN on February 27th, 2024, 5:28 am, edited 1 time in total.
Image
User avatar
CarlotaN
Posts: 50
Joined: December 5th, 2022, 3:45 am
Location: Madrid, Spain

Re: help with time counter

Post by CarlotaN »

Hello again!
First: Thank you Balala!!!
And second: The solution to the button is to replace the code

Code: Select all

;ActionPlay=[!EnableMeasure MeasureTimeDelta][!UnpauseMeasure TimeLeft][!EnableMeasure MeasureElapsedTime][!ShowMeter "StopButton"][!Redraw]
;ActionPause=[!DisableMeasure MeasureTimeDelta][!PauseMeasure TimeLeft][!PauseMeasure MeasureElapsedTime][!Redraw]
with this other one

Code: Select all

ActionPlay=[!EnableMeasure MeasureTimeDelta][!UnpauseMeasure MeasureBar][!UnpauseMeasure TimeLeft][!EnableMeasure MeasureElapsedTime][!ShowMeter "StopButton"][!Redraw]
ActionPause=[!DisableMeasure MeasureTimeDelta][!PauseMeasure MeasureBar][!PauseMeasure TimeLeft][!Redraw]
But this does not prevent the noticeable time imbalance from arriving, after two or 3 minutes.
Any solution? :confused:

Edit:
After many days of driving myself crazy, :oops: I discovered that the mismatch is fixed by activating "hardware acceleration"

Anyway, I accept suggestions to improve the skin.
Image
User avatar
balala
Rainmeter Sage
Posts: 16176
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: help with time counter

Post by balala »

CarlotaN wrote: February 24th, 2024, 2:50 pm Edit:
After many days of driving myself crazy, :oops: I discovered that the mismatch is fixed by activating "hardware acceleration"
I'm glad if you did figure out how to fix the issues, by yourself. This is a good way to improve your coding abilities, so congratulations. Hardware acceleration might be a big gun: in some cases it might help, reducing the CPU utilization, however in many cases it can cause inexplicable problems, like this time. Additionally if a user has some issues related to this settings, is extremely - extremely hard for anyone else to find the cause of the issue, because it is most probably impossible to replicate the issue.
So it's good you found the solution.
CarlotaN wrote: February 24th, 2024, 2:50 pm Anyway, I accept suggestions to improve the skin.
Just some minor things:
  • Instead of adding a [!DisableMeasure MeasureBar] bang into the OnRefreshaction option of the [Rainmeter] section, I probably would add a Disabled=1 option directly to the [MeasureBar] measure. This is much more simple in my opinion (however many would not agree this).
  • You can alter the code in a way to get the time decreasing, instead of increasing. Accordingly, the roundline should fill down, instead of filling up. If you are interested, just replace the Formula option of the [MeasureBar] measure, by the folloowing option: Formula=(( MeasureBar = 0 ) ? 599 : ( MeasureBar - 1 )) (obviously just an idea, how it looks better, depends on how you like it).
  • Instead of using Hidden options on meters to show or hide them, I probably would add IfConditions to the appropriate measures, which would hiding or showing the appropriate meters. Not like the Hidden option couldn't do the job, it definitely can, but it requires setting on dynamic variables, by the DynamicVariables=1 option. When possible, worth avoiding this option. So, the solution is to remove (or for first, comment out) the Hidden options, along with DynamicVariables=1, from all these meters: [MeterSeconds], [TimeMeter], [StopButton], [ContinueButton] and [PauseButton]. If you did this, add the following options, as they follow:

    Code: Select all

    [IsStopped]
    ...
    IfCondition=(#CURRENTSECTION#=1)
    IfTrueAction=[!HideMeter "MeterSeconds"][!HideMeter "TimeMeter"][!HideMeter "StopButton"][!Redraw]
    IfFalseAction=[!ShowMeter "MeterSeconds"][!ShowMeter "TimeMeter"][!ShowMeter "StopButton"][!Redraw]
    ...
    
    [IsPaused]
    ...
    IfCondition=(#CURRENTSECTION#=0)
    IfTrueAction=[!HideMeter "ContinueButton"]
    IfFalseAction=[!ShowMeter "ContinueButton"]
    ...
    
    [IsStarted]
    ...
    IfCondition=(#CURRENTSECTION#=0)
    IfTrueAction=[!HideMeter "PauseButton"]
    IfFalseAction=[!ShowMeter "PauseButton"]
    ...
    As I hope you did figure out, I posted here just the newly added options. Don't alter the existing ones, just add these.
    If you do this, don't forget to remove the DynamicVariables=1 option from all those meters, along with their Hidden options, because this is the main reason why we added the IfConditions.
  • The Substitute option of the [CalcElapsedHours], [CalcElapsedMinutes] and [CalcElapsedSeconds] measures look way complicated (Substitute="(.+)":"0\1","^\d(\d\d)$":"\1"). I would use a much more simple form of this option: Substitute="^(\d)$":"0\1" (if you try this out, replace all three Substitution option of al lthree measures).
User avatar
Yincognito
Rainmeter Sage
Posts: 7175
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: help with time counter

Post by Yincognito »

balala wrote: February 24th, 2024, 8:50 pm Hardware acceleration might be a big gun: in some cases it might help, reducing the CPU utilization, however in many cases it can cause inexplicable problems, like this time.
Sorry to interject, but do you know what was the OP problem regarding HA? The only 2 issues with HA that I'm aware of
are these, but I fail to see how a simple timer skin would depend on HA... :???:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
CarlotaN
Posts: 50
Joined: December 5th, 2022, 3:45 am
Location: Madrid, Spain

Re: help with time counter

Post by CarlotaN »

A thousand thanks to both of you.
I'm going to try the code that Balala offers me and I'll tell you.
Yincognito wrote: February 24th, 2024, 11:15 pm Sorry to interject, but do you know what was the OP problem regarding HA? The only 2 issues with HA that I'm aware of
are these, but I fail to see how a simple timer skin would depend on HA... :???:
If you use HA, the roundline goes faster, a little faster than the seconds, but if you don't use it, it slows down much faster than the seconds. That's where the real problem is. After a few minutes, for example 07:30, the wheel is at 06:50 minutes. :(

I repeat, thank you very much and I will respond as soon as I can. :rosegift:
Image
User avatar
balala
Rainmeter Sage
Posts: 16176
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: help with time counter

Post by balala »

Yincognito wrote: February 24th, 2024, 11:15 pm Sorry to interject, but do you know what was the OP problem regarding HA?
Not really, even if he has offered a description after your post, which sounds weird in my opinion, but who knows. However what I wrote about the hardware acceleration, IS MY OPINION! I really believe HA might be useful in some cases, but just as well might be a problem in others. Over time I saw few examples of both cases. Don't want to offend anyone, however this is really my opinion.
End of this story, from my part...
CarlotaN wrote: February 25th, 2024, 5:20 am I'm going to try the code that Balala offers me and I'll tell you.
Alright, let us (me) know how is it working when you try it out.
User avatar
CarlotaN
Posts: 50
Joined: December 5th, 2022, 3:45 am
Location: Madrid, Spain

Re: help with time counter

Post by CarlotaN »

Hello again
After testing the result is the following:
  • [!DisableMeasure MeasureBar] => Disabled=1 => OK!!!
  • Fórmula = (( MeasureBar = 0 ) ? 599 : ( MeasureBar - 1 )) => Does not show the round line
  • DynamicVariables=1 => In the cases [MeterSeconds], [TimeMeter] => it works. But it doesn't work for buttons.
  • And finally it does not work

Code: Select all

[IsStopped]
...
IfCondition=(#CURRENTSECTION#=1)
IfTrueAction=[!HideMeter "MeterSeconds"][!HideMeter "TimeMeter"][!HideMeter "StopButton"][!Redraw]
IfFalseAction=[!ShowMeter "MeterSeconds"][!ShowMeter "TimeMeter"][!ShowMeter "StopButton"][!Redraw]
...

[IsPaused]
...
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!HideMeter "ContinueButton"]
IfFalseAction=[!ShowMeter "ContinueButton"]
...

[IsStarted]
...
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!HideMeter "PauseButton"]
IfFalseAction=[!ShowMeter "PauseButton"]
...
Edit:
I put the new code here

Code: Select all

[Rainmeter]
Update=60
AccurateText=1
Background=#@#Images\cronos.png
MiddleMouseDownAction=!Refresh
OnRefreshAction=[!ShowMeter "StartButton"][!HideMeter "PauseButton"]

;-------------------------------------------------------------

[Metadata]
Name=SweepSeconds + Timer Monterey
Author=JSMorley, Creewick... y más que no me acuerdo... y algo de mi.
Information=Cronómetro. Basado en SweepSeconds y Timer Monterey
License=Creative Commons Share-Alike NC 4

;-------------------------------------------------------------

[Variables]

StartTime=-1
EndTime  =-1
PauseTime=-1

ActionPlay=[!EnableMeasure MeasureTimeDelta][!EnableMeasure MeasureElapsedTime][!EnableMeasure MeasureBar][!UnpauseMeasure MeasureBar][!UnpauseMeasure TimeLeft][!ShowMeter "StopButton"][!ShowMeter "PauseButton"][!Redraw]
ActionPause=[!DisableMeasure MeasureTimeDelta][!PauseMeasure MeasureBar][!PauseMeasure TimeLeft][!ShowMeter "StartButton"][!HideMeter "PauseButton"][!Redraw]

[TextStyle]
FontFace=Garamond
FontColor=644b40
FontSize=16
StringEffect=Shadow
FontEffectColor=fdfceb
StringStyle=Bold
StringAlign=CenterCenter
AntiAlias=1
X=70

[sController]
W=24
H=24
MouseOverAction=[!SetOption "#CurrentSection#" ImageTint DDDDDD][!UpdateMeter #CurrentSection#][!Redraw]
MouseLeaveAction=[!SetOption "#CurrentSection#" ImageTint ""][!UpdateMeter #CurrentSection#][!Redraw]

;-------------------------------------------------------------
;[MEDIDORES Y SCRIPT]
;-------------------------------------------------------------

[Lua]
Measure=Script
ScriptFile=#@#Scripts\Timer.lua

[IsStopped]
Group=Measures
Measure=Calc
Formula=(#StartTime# = -1)

[IsPaused]
Group=Measures
Measure=Calc
Formula=(#PauseTime# <> -1)

[IsStarted]
Group=Measures
Measure=Calc
Formula=(#StartTime# <> -1) && (#PauseTime# = -1)

[TrueNow]
Measure=Time
UpdateDivider=1

[TheClock]
Group=Measures
Measure=Time
Format=🔔 %H:%M

;-------------------------------------------------------------
;[ELIPSE PERCENTUAL]
;-------------------------------------------------------------

[TimeMeterBase]
Meter=Shape
Shape=Ellipse 0,0,56,56 | Fill Color 00000000 | StrokeWidth 4 | Stroke Color 2C2C2C
X=70
Y=70

[TimeLeft]
Group=Measures
Measure=Time
Format=%#S
Disabled=([IsStopped] = 1) 

[MeasureBar]
Measure=Calc
Formula=(( MeasureBar + 1 ) % 600 )
MinValue=0
MaxValue=600
Disabled=1

;-------------------------------------------------------------
;[LINEA DE TIEMPO]
;-------------------------------------------------------------

[MeterSeconds]
Group=Meters
Meter=Roundline
MeasureName=MeasureBar
X=r
Y=r
StartAngle=(-PI/2)
RotationAngle=(2*PI)
LineStart=54
LineLength=58
LineColor=f9932e
Solid=1
AntiAlias=1
Hidden=([IsStopped] = 1)
UpdateDivider=1

;-------------------------------------------------------------
;[CONTADORES DE TIEMPO]
;-------------------------------------------------------------

[MeasureCurrentTime]
Group=Measures
Measure=Time

[MeasureTimeDelta]
Group=Measures
Measure=Calc
Formula=(MeasureTimeDelta = 0 ? (MeasureCurrentTime - MeasureElapsedTime / 10) : MeasureTimeDelta)
Disabled=1

[MeasureElapsedTime]
Group=Measures
Measure=Calc
Formula=(MeasureTimeDelta = 0 ? MeasureElapsedTime : (MeasureCurrentTime - MeasureTimeDelta) * 10)

[CalcElapsedHours]
Group=Meters
Measure=Calc
Formula=Floor(MeasureElapsedTime / 10 / 3600) % 24
RegExpSubstitute=1
Substitute="^(\d)$":"0\1"

[CalcElapsedMinutes]
Group=Meters
Measure=Calc
Formula=Floor(MeasureElapsedTime / 10 / 60) % 60
RegExpSubstitute=1
Substitute="^(\d)$":"0\1"

[CalcElapsedSeconds]
Group=Meters
Measure=Calc
Formula=Floor(MeasureElapsedTime / 10) % 60
RegExpSubstitute=1
Substitute="^(\d)$":"0\1"

;-------------------------------------------------------------
;[TIEMPO]
;-------------------------------------------------------------

[VisibleTime]
Group=Measures
Meter=String
MeasureName=CalcElapsedHours
MeasureName2=CalcElapsedMinutes
MeasureName3=CalcElapsedSeconds
MeterStyle=TextStyle
NumOfDecimals=0
Y=60
Text="%1:%2:%3"

;-------------------------------------------------------------
;[RELOJ]
;-------------------------------------------------------------

[ClockMeter]
Group=Meters
MeasureName=TheClock
Meter=String
MeterStyle=TextStyle
FontSize=9
Text=
Y=80

;-------------------------------------------------------------
;[BOTONES]
;-------------------------------------------------------------

[StopButton]
Meter=Image
Group=Meters
ImageName=#@#Images\istop.png
MeterStyle=sController
X=59
Y=25
LeftMouseUpAction=[&Lua:stop()][!Redraw]
Hidden=1

[StartButton]
Group=Meters
Meter=Image
ImageName=#@#Images\iplay.png
MeterStyle=sController
X=r
Y=90
LeftMouseUpAction=[&Lua:continue()][!Delay "0"]#ActionPlay#
Hidden=([IsStopped] = 0)
DynamicVariables=1

[PauseButton]
Group=Meters
Meter=Image
ImageName=#@#Images\ipause.png
MeterStyle=sController
X=r
Y=r
LeftMouseUpAction=[&Lua:pause()]#ActionPause#
Hidden=([IsStarted] = 0)
DynamicVariables=1

[ContinueButton]
Group=Meters
Meter=Image
ImageName=#@#Images\iplay.png
MeterStyle=sController
X=r
Y=r
LeftMouseUpAction=[&Lua:continue()][!Delay "0"]#ActionPlay#
Hidden=([IsPaused] = 0)
DynamicVariables=1
I'm sure I'm doing something wrong. The round line still does not coincide with the seconds, it improves a little with active AH, but it is still unbalanced
Image