It is currently April 27th, 2024, 8:04 pm

Circular Countdown

Get help with creating, editing & fixing problems with skins
User avatar
ZipD
Posts: 37
Joined: September 10th, 2017, 4:31 pm

Circular Countdown

Post by ZipD »

I'm trying to get this countdown of X number of seconds to display using Roundline meter. Everything else in the skin works as intended except for that. How do I get a Roundline meter to display a countdown for the reducing number of seconds?

Here's the entirety of the skin except for the include:

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=0,0,0,1
AccurateText=1
DynamicWindowSize=1

---------------------------------------------------------------
; VARIABLES
---------------------------------------------------------------
[Variables]
@Include=#@#SmartChameleon.inc
SkinWidth=1440
FontName=Unispace
FontSize=16
IconSize=46
Padding=5

; Width and height for overall skin. In this case, we want both to be the same as we will be drawing circles
CircleWidth=240
CircleHeight=#CircleWidth#

; Defines the onscreen position of the circle
CircleXPos=(#SkinWidth#/2)-(#CircleWidth#/2)
CircleYPos=100

; Defines thickness of the radial line. Inner and Outer radius of meters. Generally, you'd want the Outer radius to be half of the skin's width and the Inner radius to be the same but slightly shorter. The difference between Outer and Inner will define the thickness of the line
MeterOuter=(#CircleWidth#/2)
MeterInner=(#CircleWidth#/2)-(5/100*#CircleWidth#)

; Settings for height of a text label, horizontal position (usually half of skin's width) and vertical position of the top label. To move the bottom label lower, increase the label height
LabelHeight=(#CircleHeight#/2)
LabelX=(#CircleWidth#/2)
LabelY=(#CircleHeight#/2)

---------------------------------------------------------------
; MEASURES
---------------------------------------------------------------
[MeasureCurrentTime]
Measure=Time

[MeasureDiablo4Timers]
Measure=WebParser
URL=https://helltides.com/api/schedule
RegExp=(?siU)"world_boss":\[\{"boss":"(.*)".*"timestamp":(.*)\}.*"legion":.*"timestamp":(.*)\}.*"helltide":\[\{"id":.*,"timestamp":(.*),
]]
; These 2 square brackets (]]) above are useless and should be left as is, it's just used to get the Notepad++ language formatting correct

---------------------------------------------------------------
; World Boss Measures
---------------------------------------------------------------
[MeasureWorldBossName]
Measure=WebParser
URL=[MeasureDiablo4Timers]
StringIndex=1

[MeasureWorldBossSpawnTime]
Measure=WebParser
URL=[MeasureDiablo4Timers]
StringIndex=2

[MeasureWorldBossUnixToWindowsTime]
; Convert Unix time to Windows time
; We add 11644473600 seconds as this is the number of seconds passed since midnight 1 Jan 1970
; We add another 28800 seconds to account for GMT+8 timezone
; This calculated value is also used in the countdown as well
Measure=Calc
Formula=[MeasureWorldBossSpawnTime]+11644473600+28800
Update=-1
DynamicVariables=1

[MeasureWorldBossWindowsTime]
; This is only to display the Windows time in a HH:MM:SS format
; Not used to calculate countdown
Measure=Time
TimeStamp=[MeasureWorldBossUnixToWindowsTime]
Update=-1
Format=%I:%M %p
DynamicVariables=1

[MeasureWorldBossCountdown]
Measure=UpTime
SecondsValue=([MeasureWorldBossUnixToWindowsTime:]-[MeasureCurrentTime:])
IfCondition=([MeasureWorldBossUnixToWindowsTime:]-[MeasureCurrentTime:])<0
IfTrueAction=[!SetOption MeterWorldBossTimer Text "%1 %2 (Started)"]
IfFalseAction=[!SetOption MeterWorldBossTimer Text "%1 %2 (%3)"]
; %4: Days
; %3: Hours
; %2: Minutes
; %1: Seconds
; !i!: Putting this after the format code shows the numbers with no leading zeros.
; !02i!: Putting this after the format code shows the numbers with leading zeros.
Format="%3!02i!:%2!02i!:%1!02i!"
DynamicVariables=1

[MeasureBossCountdownCircle]
Measure=Calc
Formula=[MeasureWorldBossCountdown:]
DynamicVariables=1

---------------------------------------------------------------
; Legion Measures
---------------------------------------------------------------
[MeasureLegionStartTime]
Measure=WebParser
URL=[MeasureDiablo4Timers]
StringIndex=3

[MeasureLegionUnixToWindowsTime]
Measure=Calc
Formula=[MeasureLegionStartTime]+11644473600+28800
Update=-1
DynamicVariables=1

[MeasureLegionWindowsTime]
Measure=Time
TimeStamp=[MeasureLegionUnixToWindowsTime]
Update=-1
Format=%I:%M %p
DynamicVariables=1

[MeasureLegionCountdown]
Measure=UpTime
SecondsValue=([MeasureLegionUnixToWindowsTime:]-[MeasureCurrentTime:])
IfCondition=([MeasureLegionUnixToWindowsTime:]-[MeasureCurrentTime:])<0
IfTrueAction=[!SetOption MeterLegionTimer Text "%1 (Started)"]
IfFalseAction=[!SetOption MeterLegionTimer Text "%1 (%2)"]
Format="%3!02i!:%2!02i!:%1!02i!"
DynamicVariables=1


---------------------------------------------------------------
; Helltide Measures
---------------------------------------------------------------
[MeasureHelltideStartTime]
Measure=WebParser
URL=[MeasureDiablo4Timers]
StringIndex=4

[MeasureHelltideUnixToWindowsTime]
Measure=Calc
Formula=[MeasureHelltideStartTime]+11644473600+28800
Update=-1
DynamicVariables=1

[MeasureHelltideWindowsTime]
Measure=Time
TimeStamp=[MeasureHelltideUnixToWindowsTime]
Update=-1
Format=%I:%M %p
DynamicVariables=1

[MeasureHelltideCountdown]
Measure=UpTime
SecondsValue=([MeasureHelltideUnixToWindowsTime:]-[MeasureCurrentTime:])
IfCondition=([MeasureHelltideUnixToWindowsTime:]-[MeasureCurrentTime:])<0
IfTrueAction=[!SetOption MeterHelltideTimer Text "%1 (Started)"]
IfFalseAction=[!SetOption MeterHelltideTimer Text "%1 (%2)"]
Format="%3!02i!:%2!02i!:%1!02i!"
DynamicVariables=1

---------------------------------------------------------------
; World Boss Clock Measures
---------------------------------------------------------------
[MeasureMain]
Measure=UpTime
SecondsValue=([MeasureWorldBossUnixToWindowsTime:]-[MeasureCurrentTime:])
DynamicVariables=1

---------------------------------------------------------------
; METER STYLE
---------------------------------------------------------------
[MeterIconStyle]
W=#IconSize#
Y=0

[MeterTimerStyle]
FontFace=#FontName#
FontColor=[ChamFG1]
FontSize=15
AntiAlias=1
DynamicVariables=1

---------------------------------------------------------------
; METERS
---------------------------------------------------------------
[MeterBackground]
Meter=Image
ImageName=""
W=#SkinWidth#

[MeterWorldBossIcon]
Meter=Image
MeterStyle=MeterIconStyle
X=0
ImageName=#@#WorldBoss.png

[MeterWorldBossTimer]
Meter=String
MeterStyle=MeterTimerStyle
MeasureName=MeasureWorldBossName
MeasureName2=MeasureWorldBossWindowsTime
MeasureName3=MeasureWorldBossCountdown
StringAlign=LeftCenter
X=#Padding#R
Y=(#IconSize#/2)r
Text="%1 %2 (%3)"

[MeterLegionTimer]
Meter=String
MeterStyle=MeterTimerStyle
MeasureName=MeasureLegionWindowsTime
MeasureName2=MeasureLegionCountdown
StringAlign=CenterCenter
X=(#SkinWidth#/2)
Y=r
Text="Legion %1 (%2)"

[MeterLegionIcon]
Meter=Image
MeterStyle=MeterIconStyle
X=((#SkinWidth#/2)-([MeterLegionTimer:W]/2)-#IconSize#)
ImageName=#@#Legion.png
DynamicVariables=1

[MeterHelltideTimer]
Meter=String
MeterStyle=MeterTimerStyle
MeasureName=MeasureHelltideWindowsTime
MeasureName2=MeasureHelltideCountdown
StringAlign=RightCenter
X=#SkinWidth#
Y=(#IconSize#/2)
Text="Helltide %1 (%2)"

[MeterHelltideIcon]
Meter=Image
MeterStyle=MeterIconStyle
X=(#SkinWidth#-[MeterHelltideTimer:W]-#IconSize#)
ImageName=#@#Helltide.png
DynamicVariables=1

[MeterBackgroundRoundLine]
Meter=Roundline
X=#CircleXPos#
Y=#CircleYPos#
W=#CircleWidth#
H=#CircleHeight#
LineStart=#MeterInner#
LineLength=#MeterOuter#
StartAngle=0
RotationAngle=6.2831853
LineColor=#FG2#
Solid=1
AntiAlias=1
DynamicVariables=1

[MeterValueRoundLine]
Meter=Roundline
MeasureName=MeasureBossCountdownCircle
X=#CircleXPos#
Y=#CircleYPos#
W=#CircleWidth#
H=#CircleHeight#
LineStart=#MeterInner#
LineLength=#MeterOuter#
StartAngle=4.7123889
RotationAngle=6.2831853
LineColor=#FG1#
Solid=1
AntiAlias=1
DynamicVariables=1

[MeterText]
Meter=String
MeasureName=MeasureWorldBossCountdown
X=(#CircleXPos#+#LabelX#)
Y=(#CircleYPos#+#LabelY#)
FontFace=#FontName#
FontColor=#FG1#
FontSize=(#FontSize#*1.5)
StringAlign=CenterCenter
NumOfDecimals=#Decimals#
AntiAlias=1
DynamicVariables=1
Text="%1"
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Circular Countdown

Post by Yincognito »

ZipD wrote: February 4th, 2024, 3:00 pm I'm trying to get this countdown of X number of seconds to display using Roundline meter. Everything else in the skin works as intended except for that. How do I get a Roundline meter to display a countdown for the reducing number of seconds?

Here's the entirety of the skin except for the include:

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=0,0,0,1
AccurateText=1
DynamicWindowSize=1

---------------------------------------------------------------
; VARIABLES
---------------------------------------------------------------
[Variables]
@Include=#@#SmartChameleon.inc
SkinWidth=1440
FontName=Unispace
FontSize=16
IconSize=46
Padding=5

; Width and height for overall skin. In this case, we want both to be the same as we will be drawing circles
CircleWidth=240
CircleHeight=#CircleWidth#

; Defines the onscreen position of the circle
CircleXPos=(#SkinWidth#/2)-(#CircleWidth#/2)
CircleYPos=100

; Defines thickness of the radial line. Inner and Outer radius of meters. Generally, you'd want the Outer radius to be half of the skin's width and the Inner radius to be the same but slightly shorter. The difference between Outer and Inner will define the thickness of the line
MeterOuter=(#CircleWidth#/2)
MeterInner=(#CircleWidth#/2)-(5/100*#CircleWidth#)

; Settings for height of a text label, horizontal position (usually half of skin's width) and vertical position of the top label. To move the bottom label lower, increase the label height
LabelHeight=(#CircleHeight#/2)
LabelX=(#CircleWidth#/2)
LabelY=(#CircleHeight#/2)

---------------------------------------------------------------
; MEASURES
---------------------------------------------------------------
[MeasureCurrentTime]
Measure=Time

[MeasureDiablo4Timers]
Measure=WebParser
URL=https://helltides.com/api/schedule
RegExp=(?siU)"world_boss":\[\{"boss":"(.*)".*"timestamp":(.*)\}.*"legion":.*"timestamp":(.*)\}.*"helltide":\[\{"id":.*,"timestamp":(.*),
]]
; These 2 square brackets (]]) above are useless and should be left as is, it's just used to get the Notepad++ language formatting correct

---------------------------------------------------------------
; World Boss Measures
---------------------------------------------------------------
[MeasureWorldBossName]
Measure=WebParser
URL=[MeasureDiablo4Timers]
StringIndex=1

[MeasureWorldBossSpawnTime]
Measure=WebParser
URL=[MeasureDiablo4Timers]
StringIndex=2

[MeasureWorldBossUnixToWindowsTime]
; Convert Unix time to Windows time
; We add 11644473600 seconds as this is the number of seconds passed since midnight 1 Jan 1970
; We add another 28800 seconds to account for GMT+8 timezone
; This calculated value is also used in the countdown as well
Measure=Calc
Formula=[MeasureWorldBossSpawnTime]+11644473600+28800
Update=-1
DynamicVariables=1

[MeasureWorldBossWindowsTime]
; This is only to display the Windows time in a HH:MM:SS format
; Not used to calculate countdown
Measure=Time
TimeStamp=[MeasureWorldBossUnixToWindowsTime]
Update=-1
Format=%I:%M %p
DynamicVariables=1

[MeasureWorldBossCountdown]
Measure=UpTime
SecondsValue=([MeasureWorldBossUnixToWindowsTime:]-[MeasureCurrentTime:])
IfCondition=([MeasureWorldBossUnixToWindowsTime:]-[MeasureCurrentTime:])<0
IfTrueAction=[!SetOption MeterWorldBossTimer Text "%1 %2 (Started)"]
IfFalseAction=[!SetOption MeterWorldBossTimer Text "%1 %2 (%3)"]
; %4: Days
; %3: Hours
; %2: Minutes
; %1: Seconds
; !i!: Putting this after the format code shows the numbers with no leading zeros.
; !02i!: Putting this after the format code shows the numbers with leading zeros.
Format="%3!02i!:%2!02i!:%1!02i!"
DynamicVariables=1

[MeasureBossCountdownCircle]
Measure=Calc
Formula=[MeasureWorldBossCountdown:]
DynamicVariables=1

---------------------------------------------------------------
; Legion Measures
---------------------------------------------------------------
[MeasureLegionStartTime]
Measure=WebParser
URL=[MeasureDiablo4Timers]
StringIndex=3

[MeasureLegionUnixToWindowsTime]
Measure=Calc
Formula=[MeasureLegionStartTime]+11644473600+28800
Update=-1
DynamicVariables=1

[MeasureLegionWindowsTime]
Measure=Time
TimeStamp=[MeasureLegionUnixToWindowsTime]
Update=-1
Format=%I:%M %p
DynamicVariables=1

[MeasureLegionCountdown]
Measure=UpTime
SecondsValue=([MeasureLegionUnixToWindowsTime:]-[MeasureCurrentTime:])
IfCondition=([MeasureLegionUnixToWindowsTime:]-[MeasureCurrentTime:])<0
IfTrueAction=[!SetOption MeterLegionTimer Text "%1 (Started)"]
IfFalseAction=[!SetOption MeterLegionTimer Text "%1 (%2)"]
Format="%3!02i!:%2!02i!:%1!02i!"
DynamicVariables=1


---------------------------------------------------------------
; Helltide Measures
---------------------------------------------------------------
[MeasureHelltideStartTime]
Measure=WebParser
URL=[MeasureDiablo4Timers]
StringIndex=4

[MeasureHelltideUnixToWindowsTime]
Measure=Calc
Formula=[MeasureHelltideStartTime]+11644473600+28800
Update=-1
DynamicVariables=1

[MeasureHelltideWindowsTime]
Measure=Time
TimeStamp=[MeasureHelltideUnixToWindowsTime]
Update=-1
Format=%I:%M %p
DynamicVariables=1

[MeasureHelltideCountdown]
Measure=UpTime
SecondsValue=([MeasureHelltideUnixToWindowsTime:]-[MeasureCurrentTime:])
IfCondition=([MeasureHelltideUnixToWindowsTime:]-[MeasureCurrentTime:])<0
IfTrueAction=[!SetOption MeterHelltideTimer Text "%1 (Started)"]
IfFalseAction=[!SetOption MeterHelltideTimer Text "%1 (%2)"]
Format="%3!02i!:%2!02i!:%1!02i!"
DynamicVariables=1

---------------------------------------------------------------
; World Boss Clock Measures
---------------------------------------------------------------
[MeasureMain]
Measure=UpTime
SecondsValue=([MeasureWorldBossUnixToWindowsTime:]-[MeasureCurrentTime:])
DynamicVariables=1

---------------------------------------------------------------
; METER STYLE
---------------------------------------------------------------
[MeterIconStyle]
W=#IconSize#
Y=0

[MeterTimerStyle]
FontFace=#FontName#
FontColor=[ChamFG1]
FontSize=15
AntiAlias=1
DynamicVariables=1

---------------------------------------------------------------
; METERS
---------------------------------------------------------------
[MeterBackground]
Meter=Image
ImageName=""
W=#SkinWidth#

[MeterWorldBossIcon]
Meter=Image
MeterStyle=MeterIconStyle
X=0
ImageName=#@#WorldBoss.png

[MeterWorldBossTimer]
Meter=String
MeterStyle=MeterTimerStyle
MeasureName=MeasureWorldBossName
MeasureName2=MeasureWorldBossWindowsTime
MeasureName3=MeasureWorldBossCountdown
StringAlign=LeftCenter
X=#Padding#R
Y=(#IconSize#/2)r
Text="%1 %2 (%3)"

[MeterLegionTimer]
Meter=String
MeterStyle=MeterTimerStyle
MeasureName=MeasureLegionWindowsTime
MeasureName2=MeasureLegionCountdown
StringAlign=CenterCenter
X=(#SkinWidth#/2)
Y=r
Text="Legion %1 (%2)"

[MeterLegionIcon]
Meter=Image
MeterStyle=MeterIconStyle
X=((#SkinWidth#/2)-([MeterLegionTimer:W]/2)-#IconSize#)
ImageName=#@#Legion.png
DynamicVariables=1

[MeterHelltideTimer]
Meter=String
MeterStyle=MeterTimerStyle
MeasureName=MeasureHelltideWindowsTime
MeasureName2=MeasureHelltideCountdown
StringAlign=RightCenter
X=#SkinWidth#
Y=(#IconSize#/2)
Text="Helltide %1 (%2)"

[MeterHelltideIcon]
Meter=Image
MeterStyle=MeterIconStyle
X=(#SkinWidth#-[MeterHelltideTimer:W]-#IconSize#)
ImageName=#@#Helltide.png
DynamicVariables=1

[MeterBackgroundRoundLine]
Meter=Roundline
X=#CircleXPos#
Y=#CircleYPos#
W=#CircleWidth#
H=#CircleHeight#
LineStart=#MeterInner#
LineLength=#MeterOuter#
StartAngle=0
RotationAngle=6.2831853
LineColor=#FG2#
Solid=1
AntiAlias=1
DynamicVariables=1

[MeterValueRoundLine]
Meter=Roundline
MeasureName=MeasureBossCountdownCircle
X=#CircleXPos#
Y=#CircleYPos#
W=#CircleWidth#
H=#CircleHeight#
LineStart=#MeterInner#
LineLength=#MeterOuter#
StartAngle=4.7123889
RotationAngle=6.2831853
LineColor=#FG1#
Solid=1
AntiAlias=1
DynamicVariables=1

[MeterText]
Meter=String
MeasureName=MeasureWorldBossCountdown
X=(#CircleXPos#+#LabelX#)
Y=(#CircleYPos#+#LabelY#)
FontFace=#FontName#
FontColor=#FG1#
FontSize=(#FontSize#*1.5)
StringAlign=CenterCenter
NumOfDecimals=#Decimals#
AntiAlias=1
DynamicVariables=1
Text="%1"
The Roundline meter needs the percentual value of a measure in order to work as expected. Right now, your MeasureBossCountdownCircle (just an example) only provides the plain actual value in seconds, and not "how much of a total is completed" like a percentage would do. To make it work, assuming everything else is correctly set and functional, you'd need to add a MaxValue to the said measure, representing the number of seconds you consider as maximum possible (i.e. when the Roundline arc is equal to RotationAngle):
https://docs.rainmeter.net/manual/measures/general-options/#MaxValue
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
ZipD
Posts: 37
Joined: September 10th, 2017, 4:31 pm

Re: Circular Countdown

Post by ZipD »

Thanks @Yincognito, you got me on the right path. The full circle or MaxValue here should be a stored value. I cannot do this with the existing measure even though it has the value I needed because it needs to keep updating:

Code: Select all

[MeasureWorldBossCountdown]
Measure=UpTime
SecondsValue=([MeasureWorldBossUnixToWindowsTime:]-[MeasureCurrentTime:])
IfCondition=([MeasureWorldBossUnixToWindowsTime:]-[MeasureCurrentTime:])<0
IfTrueAction=[!SetOption MeterWorldBossTimer Text "%1 %2 (%4)"][!SetOption MeterWorldBossTimer InlineSetting "Color | #FG2#"]
IfFalseAction=[!SetOption MeterWorldBossTimer Text "%1 %2 (%3)"][!SetOption MeterWorldBossTimer InlineSetting "Color | #FG1#"]
Format="%3!02i!:%2!02i!:%1!02i!"
DynamicVariables=1
So I had to duplicate it using a different name but add Update=-1 to stop it from updating. As best practice, I used this to write the value to a variable so I can monitor if the value changed in the debug log (thankfully, it did not):

Code: Select all

[MeasureStoreWorldBossMaxValue]
; This is to store an unchanging value of exactly when we get the World Boss time minus current system time. This is used as the 100 percent basis for the roundline meter 'MeterValueRoundLine'
Measure=UpTime
SecondsValue=([MeasureWorldBossUnixToWindowsTime:]-[MeasureCurrentTime:])
IfCondition=([MeasureWorldBossUnixToWindowsTime:]-[MeasureCurrentTime:])<0
IfTrueAction=[!SetVariable WorldBossMaxValue [MeasureStoreWorldBossMaxValue]]
IfFalseAction=[!SetVariable WorldBossMaxValue [MeasureStoreWorldBossMaxValue:]]
Format="%3!02i!:%2!02i!:%1!02i!"
Update=-1
DynamicVariables=1
And so with both the current value from [MeasureWorldBossCountdown], and [MeasureStoreWorldBossMaxValue] as the MaxValue (written to a variable called #WorldBossMaxValue#), I was finally able to get a reducing circle with this measure:

Code: Select all

[MeasureBossCountdownCircle]
Measure=Calc
Formula=[MeasureWorldBossCountdown:]
MaxValue=#WorldBossMaxValue#
DynamicVariables=1
Here's the full code minus the include in case anyone needs it

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=0,0,0,1
AccurateText=1
DynamicWindowSize=1

[Metadata]
Name=Diablo IV Reset Timers
Author=ZipD
Information=Displays countdown for all event timers in Blizzard's Diablo IV game.
Version=1.0
License=Attribution-NonCommercial-ShareAlike 4.0 International

---------------------------------------------------------------
; VARIABLES
---------------------------------------------------------------
[Variables]
@Include=#@#SmartChameleon.inc
SkinWidth=1440
FontName=Unispace
FontSize=16
IconSize=46
Padding=5

; Event Times. This is how long each event will last, in seconds, when it begins
WorldBossRunningSeconds=900
WorldBossMaxValue=""
HelltideRunningSeconds=3300

; Width and height for overall skin. In this case, we want both to be the same as we will be drawing circles
CircleWidth=240
CircleHeight=#CircleWidth#

; Defines the onscreen position of the circle
CircleXPos=(#SkinWidth#/2)-(#CircleWidth#/2)
CircleYPos=100

; Defines thickness of the radial line. Inner and Outer radius of meters. Generally, you'd want the Outer radius to be half of the skin's width and the Inner radius to be the same but slightly shorter. The difference between Outer and Inner will define the thickness of the line
MeterOuter=(#CircleWidth#/2)
MeterInner=(#CircleWidth#/2)-(5/100*#CircleWidth#)

; Settings for height of a text label, horizontal position (usually half of skin's width) and vertical position of the top label. To move the bottom label lower, increase the label height
LabelHeight=(#CircleHeight#/2)
LabelX=(#CircleWidth#/2)
LabelY=(#CircleHeight#/2)

---------------------------------------------------------------
; MEASURES
---------------------------------------------------------------
[MeasureCurrentTime]
Measure=Time

[MeasureDiablo4Timers]
Measure=WebParser
URL=https://helltides.com/api/schedule
RegExp=(?siU)"world_boss":\[\{"boss":"(.*)".*"timestamp":(.*)\}.*"legion":.*"timestamp":(.*)\}.*"helltide":\[\{"id":.*,"timestamp":(.*),
]]
; These 2 square brackets (]]) above are useless and should be left as is, it's just used to get the Notepad++ language formatting correct

---------------------------------------------------------------
; World Boss Measures
---------------------------------------------------------------
[MeasureWorldBossName]
Measure=WebParser
URL=[MeasureDiablo4Timers]
StringIndex=1

[MeasureWorldBossSpawnTime]
Measure=WebParser
URL=[MeasureDiablo4Timers]
StringIndex=2

[MeasureWorldBossUnixToWindowsTime]
; Convert Unix time to Windows time
; We add 11644473600 seconds as this is the number of seconds passed since midnight 1 Jan 1970
; We add another 28800 seconds to account for GMT+8 timezone
; This calculated value is also used in the countdown as well
Measure=Calc
Formula=[MeasureWorldBossSpawnTime]+11644473600+28800
DynamicVariables=1

[MeasureWorldBossWindowsTime]
; This is only to display the Windows time in a HH:MM:SS format
; Not used to calculate countdown
Measure=Time
TimeStamp=[MeasureWorldBossUnixToWindowsTime]
Format=%I:%M %p
DynamicVariables=1

[MeasureWorldBossCountdown]
Measure=UpTime
SecondsValue=([MeasureWorldBossUnixToWindowsTime:]-[MeasureCurrentTime:])
IfCondition=([MeasureWorldBossUnixToWindowsTime:]-[MeasureCurrentTime:])<0
IfTrueAction=[!SetOption MeterWorldBossTimer Text "%1 %2 (%4)"][!SetOption MeterWorldBossTimer InlineSetting "Color | #FG2#"]
IfFalseAction=[!SetOption MeterWorldBossTimer Text "%1 %2 (%3)"][!SetOption MeterWorldBossTimer InlineSetting "Color | #FG1#"]
; %4: Days
; %3: Hours
; %2: Minutes
; %1: Seconds
; !i!: Putting this after the format code shows the numbers with no leading zeros.
; !02i!: Putting this after the format code shows the numbers with leading zeros.
Format="%3!02i!:%2!02i!:%1!02i!"
DynamicVariables=1

[MeasureWorldBossRunning]
Measure=UpTime
SecondsValue=(#WorldBossRunningSeconds#-[MeasureWorldBossCountdown:])
Format="%3!02i!:%2!02i!:%1!02i!"
DynamicVariables=1

[MeasureStoreWorldBossMaxValue]
; This is to store an unchanging value of exactly when we get the World Boss time minus current system time. This is used as the 100 percent basis for the roundline meter 'MeterValueRoundLine'
Measure=UpTime
SecondsValue=([MeasureWorldBossUnixToWindowsTime:]-[MeasureCurrentTime:])
IfCondition=([MeasureWorldBossUnixToWindowsTime:]-[MeasureCurrentTime:])<0
IfTrueAction=[!SetVariable WorldBossMaxValue [MeasureStoreWorldBossMaxValue]]
IfFalseAction=[!SetVariable WorldBossMaxValue [MeasureStoreWorldBossMaxValue:]]
Format="%3!02i!:%2!02i!:%1!02i!"
Update=-1
DynamicVariables=1

[MeasureBossCountdownCircle]
Measure=Calc
Formula=[MeasureWorldBossCountdown:]
MaxValue=#WorldBossMaxValue#
DynamicVariables=1

---------------------------------------------------------------
; Legion Measures
---------------------------------------------------------------
[MeasureLegionStartTime]
Measure=WebParser
URL=[MeasureDiablo4Timers]
StringIndex=3

[MeasureLegionUnixToWindowsTime]
Measure=Calc
Formula=[MeasureLegionStartTime]+11644473600+28800
DynamicVariables=1

[MeasureLegionWindowsTime]
Measure=Time
TimeStamp=[MeasureLegionUnixToWindowsTime]
Format=%I:%M %p
DynamicVariables=1

[MeasureLegionCountdown]
Measure=UpTime
SecondsValue=([MeasureLegionUnixToWindowsTime:]-[MeasureCurrentTime:])
IfCondition=([MeasureLegionUnixToWindowsTime:]-[MeasureCurrentTime:])<0
IfTrueAction=[!SetOption MeterLegionTimer Text "%1 (Started)"][!SetOption MeterLegionTimer InlineSetting "Color | #FG2#"]
IfFalseAction=[!SetOption MeterLegionTimer Text "%1 (%2)"][!SetOption MeterLegionTimer InlineSetting "Color | #FG1#"]
Format="%3!02i!:%2!02i!:%1!02i!"
DynamicVariables=1


---------------------------------------------------------------
; Helltide Measures
---------------------------------------------------------------
[MeasureHelltideStartTime]
Measure=WebParser
URL=[MeasureDiablo4Timers]
StringIndex=4

[MeasureHelltideUnixToWindowsTime]
Measure=Calc
Formula=[MeasureHelltideStartTime]+11644473600+28800
DynamicVariables=1

[MeasureHelltideWindowsTime]
Measure=Time
TimeStamp=[MeasureHelltideUnixToWindowsTime]
Format=%I:%M %p
DynamicVariables=1

[MeasureHelltideCountdown]
Measure=UpTime
SecondsValue=([MeasureHelltideUnixToWindowsTime:]-[MeasureCurrentTime:])
IfCondition=([MeasureHelltideUnixToWindowsTime:]-[MeasureCurrentTime:])<0
IfTrueAction=[!SetOption MeterHelltideTimer Text "%1 (%3)"][!SetOption MeterHelltideTimer InlineSetting "Color | #FG2#"]
IfFalseAction=[!SetOption MeterHelltideTimer Text "%1 (%2)"][!SetOption MeterHelltideTimer InlineSetting "Color | #FG1#"]
Format="%3!02i!:%2!02i!:%1!02i!"
DynamicVariables=1

[MeasureHelltideRunning]
Measure=UpTime
SecondsValue=(#HelltideRunningSeconds#-[MeasureHelltideCountdown:])
Format="%3!02i!:%2!02i!:%1!02i!"
DynamicVariables=1

---------------------------------------------------------------
; World Boss Clock Measures
---------------------------------------------------------------
[MeasureMain]
Measure=UpTime
SecondsValue=([MeasureWorldBossUnixToWindowsTime:]-[MeasureCurrentTime:])
DynamicVariables=1

---------------------------------------------------------------
; METER STYLE
---------------------------------------------------------------
[MeterIconStyle]
W=#IconSize#
Y=0

[MeterTimerStyle]
FontFace=#FontName#
FontColor=[ChamFG1]
FontSize=15
AntiAlias=1
DynamicVariables=1

---------------------------------------------------------------
; METERS
---------------------------------------------------------------
[MeterBackground]
Meter=Image
ImageName=""
W=#SkinWidth#

[MeterWorldBossIcon]
Meter=Image
MeterStyle=MeterIconStyle
X=0
ImageName=#@#WorldBoss.png

[MeterWorldBossTimer]
Meter=String
MeterStyle=MeterTimerStyle
MeasureName=MeasureWorldBossName
MeasureName2=MeasureWorldBossWindowsTime
MeasureName3=MeasureWorldBossCountdown
MeasureName4=MeasureWorldBossRunning
StringAlign=LeftCenter
X=#Padding#R
Y=(#IconSize#/2)r
Text="%1 %2 (%3)"
InlinePattern=\(.*\)
InlineSetting="Color | #FG1#"

[MeterLegionTimer]
Meter=String
MeterStyle=MeterTimerStyle
MeasureName=MeasureLegionWindowsTime
MeasureName2=MeasureLegionCountdown
StringAlign=CenterCenter
X=(#SkinWidth#/2)
Y=r
Text="%1 (%2)"
InlinePattern=\(.*\)
InlineSetting="Color | #FG1#"

[MeterLegionIcon]
Meter=Image
MeterStyle=MeterIconStyle
X=((#SkinWidth#/2)-([MeterLegionTimer:W]/2)-#IconSize#)
ImageName=#@#Legion.png
DynamicVariables=1

[MeterHelltideTimer]
Meter=String
MeterStyle=MeterTimerStyle
MeasureName=MeasureHelltideWindowsTime
MeasureName2=MeasureHelltideCountdown
MeasureName3=MeasureHelltideRunning
StringAlign=RightCenter
X=#SkinWidth#
Y=(#IconSize#/2)
Text="%1 (%2)"
InlinePattern=\(.*\)
InlineSetting="Color | #FG1#"

[MeterHelltideIcon]
Meter=Image
MeterStyle=MeterIconStyle
X=(#SkinWidth#-[MeterHelltideTimer:W]-#IconSize#)
ImageName=#@#Helltide.png
DynamicVariables=1

[MeterBackgroundRoundLine]
Meter=Roundline
X=#CircleXPos#
Y=#CircleYPos#
W=#CircleWidth#
H=#CircleHeight#
LineStart=#MeterInner#
LineLength=#MeterOuter#
StartAngle=0
RotationAngle=6.2831853
LineColor=#FG2#
Solid=1
AntiAlias=1
DynamicVariables=1

[MeterValueRoundLine]
Meter=Roundline
MeasureName=MeasureBossCountdownCircle
X=#CircleXPos#
Y=#CircleYPos#
W=#CircleWidth#
H=#CircleHeight#
LineStart=#MeterInner#
LineLength=#MeterOuter#
StartAngle=4.7123889
RotationAngle=6.2831853
LineColor=#FG1#
Solid=1
AntiAlias=1
DynamicVariables=1

[MeterText]
Meter=String
MeasureName=MeasureWorldBossCountdown
X=(#CircleXPos#+#LabelX#)
Y=(#CircleYPos#+#LabelY#)
FontFace=#FontName#
FontColor=#FG1#
FontSize=(#FontSize#*1.5)
StringAlign=CenterCenter
NumOfDecimals=#Decimals#
AntiAlias=1
DynamicVariables=1
Text="%1"
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Circular Countdown

Post by Yincognito »

ZipD wrote: February 5th, 2024, 6:55 pmThanks @Yincognito, you got me on the right path. The full circle or MaxValue here should be a stored value. I cannot do this with the existing measure even though it has the value I needed because it needs to keep updating [...]
You're welcome, glad you figured out the rest - well done! Yeah, I suspected that your maximum would change depending on what you got from another source - you came up with a good solution for that, indeed. :thumbup:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth