It is currently April 27th, 2024, 8:58 am

[solved] Having trouble with another equation - value=seconds

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

[solved] Having trouble with another equation - value=seconds

Post by CodeCode »

Hello, so I have ran into a slightly different problem using the seconds equivalent of two measures to establish when they become equal.
I have this:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
THrs1=03
TMin1=07
TSec1=00

[MeasureTimeHour]
Measure=Time
Format=%H
DynamicVariables=1

[MeasureTimeMinute]
Measure=Time
Format=%M
DynamicVariables=1

[MeasureTimeSeconds]
Measure=Time
Format=%S
DynamicVariables=1

[TimeH]
Measure=Time
Format=%H
IfConditionMode=1
DynamicVariables=1

[MeasureCalca]
Measure=Calc
Formula=((86400+([TimeH]-#THrs1#)*3600+(([TimeH:TimeStamp]%3600-(#TMin1#*60+#Tsec1#))))%86400)
InvertMeasure=1
MaxValue=86400
DynamicVariables=1

[MeasureDay]
Measure=Calc
Formula=(((MeasureTimeHour * 60 + MeasureTimeMinute) * 60) + MeasureTimeSeconds)
IfCondition=([MeasureDay]=[MeasureCalca])
IfTrueAction=[#MatchA#]
IfConditionMode=1
DynamicVariables=1
Even when the seconds match up in the debug skins section. the IfTrueAction is not executed e.g. =[#MatchA#] to play somesound.wav

Any help is appreciated.
Last edited by CodeCode on September 25th, 2023, 4:12 am, edited 1 time in total.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Having trouble with another equation - value=seconds

Post by CodeCode »

Well, I am close as setting the MeasureCalcA instead to a set variable #Seconds# to a static number the IfTrueAction is executed.

Not sure but I hope that is closer. :confused:
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Having trouble with another equation - value=seconds

Post by eclectic-tech »

CodeCode wrote: September 24th, 2023, 6:54 pm Well, I am close as setting the MeasureCalcA instead to a set variable #Seconds# to a static number the IfTrueAction is executed.

Not sure but I hope that is closer. :confused:
I would suggest using TimeStamp (values in seconds) whenever you want to deal with time or dates.
it is eliminates needing to measure the hours, minutes, and seconds and then create formulas to convert them to seconds values.

Your code to compare the current time of day with a defined time can be done with just 3 measures.
timestamplog.png

Code: Select all

[Rainmeter]
Update=1000

[Variables]
THrs1=14
TMin1=25
TSec1=00

; The NUMBER value is the current TiemStamp
[MeasureTimeNow]
Measure=Time

; This returns the current day's time in seconds
[MeasureDaySeconds]
Measure=Calc
Formula=MeasureTimeNow%86400

; This converts the set time variables to seconds
; Then compares the current time (in seconds) to the converted set time (in seconds) 
[MeasureTimeSet]
Measure=Calc
Formula=(#THrs1#*3600) + (#TMin1#*60) + #TSec1#
IfCondition=(MeasureDaySeconds=MeasureTimeSet)
IfTrueAction=[#MatchA#]
IfFalseAction=[]

; [MeasureTimeHour]
; Measure=Time
; Format=%H
; DynamicVariables=1

; [MeasureTimeMinute]
; Measure=Time
; Format=%M
; DynamicVariables=1

; [MeasureTimeSeconds]
; Measure=Time
; Format=%S
; DynamicVariables=1

; [TimeH]
; Measure=Time
; Format=%H
; IfConditionMode=1
; DynamicVariables=1

; [MeasureCalca]
; Measure=Calc
; Formula=((86400+([TimeH]-#THrs1#)*3600+(([TimeH:TimeStamp]%3600-(#TMin1#*60+#Tsec1#))))%86400)
; InvertMeasure=1
; MaxValue=86400
; DynamicVariables=1

; [MeasureDay]
; Measure=Calc
; Formula=(((MeasureTimeHour * 60 + MeasureTimeMinute) * 60) + MeasureTimeSeconds)
; IfCondition=(MeasureDaySeconds=MeasureTimeSet)
; IfTrueAction=[#MatchA#]
; IfConditionMode=1
; DynamicVariables=1

[Bummy]
Meter=String
You do not have the required permissions to view the files attached to this post.
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Having trouble with another equation - value=seconds

Post by CodeCode »

eclectic-tech wrote: September 24th, 2023, 10:36 pm I would suggest using TimeStamp (values in seconds) whenever you want to deal with time or dates.
it is eliminates needing to measure the hours, minutes, and seconds and then create formulas to convert them to seconds values.

Your code to compare the current time of day with a defined time can be done with just 3 measures.timestamplog.png

Code: Select all

[Rainmeter]
Update=1000

[Variables]
THrs1=14
TMin1=25
TSec1=00

; The NUMBER value is the current TiemStamp
[MeasureTimeNow]
Measure=Time

; This returns the current day's time in seconds
[MeasureDaySeconds]
Measure=Calc
Formula=MeasureTimeNow%86400

; This converts the set time variables to seconds
; Then compares the current time (in seconds) to the converted set time (in seconds) 
[MeasureTimeSet]
Measure=Calc
Formula=(#THrs1#*3600) + (#TMin1#*60) + #TSec1#
IfCondition=(MeasureDaySeconds=MeasureTimeSet)
IfTrueAction=[#MatchA#]
IfFalseAction=[]

[Bummy]
Meter=String
Alright! I was definitely overcomplicating the timenow value. That was tripping me up quite a bit.

Thank You eclectictech, for taking the time to sort out a solution. :rosegift:
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.