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.
Script included:
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.
Code:
[Rainmeter]Update=60AccurateText=1Background=#@#Images\cronos.pngMiddleMouseDownAction=!RefreshOnRefreshAction=[!DisableMeasure MeasureTimeDelta][!DisableMeasure MeasureBar][!HideMeter "StopButton"][!HideMeter "PauseButton"][!ShowMeter "StartButton"];-------------------------------------------------------------[Metadata]Name=SweepSeconds + Timer MontereyAuthor=JSMorley, Creewick... y más que no me acuerdo... y algo de mi.Information=Cronómetro. Basado en SweepSeconds y Timer MontereyLicense=Creative Commons Share-Alike NC 4;-------------------------------------------------------------[Variables]StartTime=-1EndTime =-1PauseTime=-1ActionPlay=[!EnableMeasure MeasureTimeDelta][!UnpauseMeasure TimeLeft][!EnableMeasure MeasureElapsedTime][!ShowMeter "StopButton"][!Redraw]ActionPause=[!DisableMeasure MeasureTimeDelta][!PauseMeasure TimeLeft][!PauseMeasure MeasureElapsedTime][!Redraw][TextStyle]FontFace=GaramondFontColor=644b40FontSize=16StringEffect=ShadowFontEffectColor=fdfcebStringStyle=BoldStringAlign=CenterCenterAntiAlias=1X=70[sController]W=24H=24MouseOverAction=[!SetOption "#CurrentSection#" ImageTint DDDDDD][!UpdateMeter #CurrentSection#][!Redraw]MouseLeaveAction=[!SetOption "#CurrentSection#" ImageTint ""][!UpdateMeter #CurrentSection#][!Redraw];-------------------------------------------------------------;[MEDIDORES Y SCRIPT];-------------------------------------------------------------[Lua]Measure=ScriptScriptFile=#@#Scripts\Timer.lua[IsStopped]Group=MeasuresMeasure=CalcFormula=(#StartTime# = -1)DynamicVariables=1[IsPaused]Group=MeasuresMeasure=CalcFormula=(#PauseTime# <> -1)DynamicVariables=1[IsStarted]Group=MeasuresMeasure=CalcFormula=(#StartTime# <> -1) && (#PauseTime# = -1)DynamicVariables=1[TrueNow]Measure=TimeUpdateDivider=1[TheClock]Group=MeasuresMeasure=TimeDynamicVariables=1Format=🔔 %H:%M;-------------------------------------------------------------;[ELIPSE PERCENTUAL];-------------------------------------------------------------[TimeMeterBase]Meter=ShapeShape=Ellipse 0,0,56,56 | Fill Color 00000000 | StrokeWidth 4 | Stroke Color 2C2C2CX=70Y=70[TimeLeft]Group=MeasuresMeasure=TimeFormat=%#SAverageSize=10Disabled=([IsStopped] = 1) DynamicVariables=1[MeasureBar]Measure=CalcFormula=(TimeLeft % 59) / 60;-------------------------------------------------------------;[LINEA DE TIEMPO];-------------------------------------------------------------[MeterSeconds]Group=MetersMeter=RoundlineMeasureName=MeasureBarX=rY=rStartAngle=(-PI/2)RotationAngle=(2*PI)LineStart=54LineLength=58LineColor=f9932eSolid=1AntiAlias=1Hidden=([IsStopped] = 1)DynamicVariables=1UpdateDivider=1;-------------------------------------------------------------;[CONTADORES DE TIEMPO];-------------------------------------------------------------[MeasureCurrentTime]Group=MeasuresMeasure=Time[MeasureTimeDelta]Group=MeasuresMeasure=CalcFormula=(MeasureTimeDelta = 0 ? (MeasureCurrentTime - MeasureElapsedTime / 10) : MeasureTimeDelta)Disabled=1[MeasureElapsedTime]Group=MeasuresMeasure=CalcFormula=(MeasureTimeDelta = 0 ? MeasureElapsedTime : (MeasureCurrentTime - MeasureTimeDelta) * 10)[CalcElapsedHours]Group=MetersMeasure=CalcFormula=Floor(MeasureElapsedTime / 10 / 3600) % 24RegExpSubstitute=1Substitute="(.+)":"0\1","^\d(\d\d)$":"\1"[CalcElapsedMinutes]Group=MetersMeasure=CalcFormula=Floor(MeasureElapsedTime / 10 / 60) % 60RegExpSubstitute=1Substitute="(.+)":"0\1","^\d(\d\d)$":"\1"[CalcElapsedSeconds]Group=MetersMeasure=CalcFormula=Floor(MeasureElapsedTime / 10) % 60RegExpSubstitute=1Substitute="(.+)":"0\1","^\d(\d\d)$":"\1";-------------------------------------------------------------;[TIEMPO];-------------------------------------------------------------[VisibleTime]Group=MeasuresMeter=StringMeasureName=CalcElapsedHoursMeasureName2=CalcElapsedMinutesMeasureName3=CalcElapsedSecondsMeterStyle=TextStyleNumOfDecimals=0Y=60Text="%1:%2:%3";-------------------------------------------------------------;[RELOJ];-------------------------------------------------------------[TimeMeter]Group=MetersMeasureName=TheClockMeter=StringMeterStyle=TextStyleFontSize=9Text=Y=80Hidden=([IsStopped] = 1);-------------------------------------------------------------;[BOTONES];-------------------------------------------------------------[StopButton]Meter=ImageGroup=MetersImageName=#@#Images\istop.pngMeterStyle=sControllerX=59Y=25LeftMouseUpAction=[&Lua:stop()][!SetOption MeterPlayPause ImageName "#@#Botones\iplay.png"][!DisableMeasure MeasureTimeDelta][!Redraw]Hidden=([IsStopped] = 1)DynamicVariables=1[StartButton]Group=MetersMeter=ImageImageName=#@#Images\iplay.pngMeterStyle=sControllerX=rY=90LeftMouseUpAction=[&Lua:continue()]#ActionPlay#[!Delay "0"][!ShowMeter "PauseButton"][!EnableMeasure MeasureBar]Hidden=([IsStopped] = 0)DynamicVariables=1[PauseButton]Group=MetersMeter=ImageImageName=#@#Images\ipause.pngMeterStyle=sControllerX=rY=rLeftMouseUpAction=[&Lua:pause()]#ActionPause#Hidden=([IsStarted] = 0)DynamicVariables=1[ContinueButton]Group=MetersMeter=ImageImageName=#@#Images\iplay.pngMeterStyle=sControllerX=rY=rLeftMouseUpAction=[&Lua:continue()]#ActionPlay#[!Delay "0"][!ShowMeter "PauseButton"]Hidden=([IsPaused] = 0)DynamicVariables=1
Code:
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 0endfunction pause() local now = SKIN:GetMeasure('TrueNow'):GetValue() setAndSave('PauseTime', now) SKIN:Bang('!SetOption', 'Now', 'AverageSize', 1) update() return 0endfunction 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 0endfunction stop() SKIN:Bang('PlayStop') setAndSave('StartTime', -1) setAndSave('EndTime', -1) setAndSave('PauseTime', -1) SKIN:Bang('!Refresh') return 0endfunction 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 0endfunction 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 0endfunction setAndSave(variable, value) SKIN:Bang('!WriteKeyValue', 'Variables', variable, value) SKIN:Bang('!SetVariable', variable, value)endfunction update() SKIN:Bang('!UpdateMeasureGroup', 'Measures') SKIN:Bang('!UpdateMeterGroup', 'Meters')end
Statistics: Posted by CarlotaN — Today, 4:58 am — Replies 3 — Views 39