It is currently January 22nd, 2022, 6:22 am

How to display UI items in set intervals

Help with creating, editing & fixing problems with skins
TheDrifter76
Posts: 3
Joined: January 5th, 2022, 10:23 pm

How to display UI items in set intervals

Post by TheDrifter76 »

I'd like to use the clock overlay to help me keep track of time while I play games. However, I dont want to constantly see the clock at all times. Is there a way I could set the clock to unhide itself every 10 minutes , slowly display itself for 10 seconds, then slowly rehide itself until the next 10 minutes?
User avatar
balala
Rainmeter Sage
Posts: 13719
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to display UI items in set intervals

Post by balala »

TheDrifter76 wrote: January 5th, 2022, 10:32 pm I'd like to use the clock overlay to help me keep track of time while I play games. However, I dont want to constantly see the clock at all times. Is there a way I could set the clock to unhide itself every 10 minutes , slowly display itself for 10 seconds, then slowly rehide itself until the next 10 minutes?
There is for sure. Here is an example. The basic idea is to have a measure which increments from 0 to a variable value (different when the clock is shown and when it is hidden), then act accordingly. See for instance the following code:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
HiddenInterval=600
ShownInterval=10
Interval=#ShownInterval#

[MeasureTime]
Measure=Time
Format=%#H:%M:%S

[MeasureInterval]
Measure=Calc
Formula=(( MeasureInterval + 1 ) % #Interval# )
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!SetVariable Interval "((#Interval#=#ShownInterval#)?#HiddenInterval#:#ShownInterval#)"][!ToggleFade]
DynamicVariables=1

[MeterTime]
Meter=STRING
MeasureName=MeasureTime
X=0
Y=0
Padding=25,15,25,15
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=28
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=%1
You have to set the following variables in the [Variables] section:
  • HiddenInterval is the number of seconds while the skin will be hidden.
  • ShownInterval is obviously the number of seconds while the skin will be shown.
  • Don't change the Interval variable.
Both variables (HiddenInterval and ShownInterval) are expressed in seconds.
The skin starts shown. After a number of seconds equal to ShownInterval, you get it hidden. After a time equal with HiddenInterval, you get it shown. And so on. Just make sure to properly set the ShownInterval and HiddenInterval variables.
And one more you have to know: if you want to show the skin over a full-screen game, you have to set it Always on top. If you don't know how to do this, please let me know.
TheDrifter76
Posts: 3
Joined: January 5th, 2022, 10:23 pm

Re: How to display UI items in set intervals

Post by TheDrifter76 »

So i just copy paste the code anywhere in the skin?
also, I see a "stay topmost" option, but no, I dont know how to do "always on top" option
User avatar
balala
Rainmeter Sage
Posts: 13719
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to display UI items in set intervals

Post by balala »

TheDrifter76 wrote: January 7th, 2022, 5:41 am So i just copy paste the code anywhere in the skin?
also, I see a "stay topmost" option, but no, I dont know how to do "always on top" option
Do you have a skin? If you have one, yep, paste ther code into that and refresh the skin. If you don't have, do the followings:
  • Create a new skin. Here is how can you do this.
  • Copy - paste the above posted code into the new skin's .ini file. Save and refresh the skin.
  • Now it should do what is expected to do: show the clock for a time equal to ShownInterval, then hide it for a period equal to HiddenInterval. Then the process resumes, going on again and again.
Have you succeeded and does it work?
TheDrifter76
Posts: 3
Joined: January 5th, 2022, 10:23 pm

Re: How to display UI items in set intervals

Post by TheDrifter76 »

since I've pasted the code, I havn't seen the clock once. Did I do it right? (using ScrollTime btw)

Code: Select all

[rainmeter]
Author= Manuel Vrhovac (manci5.deviantart.com)
update=1000

[Metadata]
Name=
Author=
Information=
License=
Version=

[variables]

;				Do you want animated hours too?
	AnimatedHours=0
	AnimatedMinutes=1
;				MyriadPro or LucidaGrande font?
	Font=MyriadPro
;				Dark or Light shadow?
	Shadow=Dark





position1=11
position2=113
yposition1=10
yposition2=10
offset=[hoursformula]

[hour]
measure=time
format=%I

[seconds]
measure=time
format=%S

[minutes]
measure=time
format=%M

[houroffset]
measure=calc
formula=minutes*0.58

[hoursformula]
measure=calc
formula=(hour*(-70))+54-(houroffset*#animatedhours#)

[minutesformula]
measure=calc
formula=4+minutes*(-70)+(((seconds-30)*(-1.16)+35)*#animatedminutes#)+#yposition2#

[offsety]
measure=calc
formula=120-(hour*(-70))+(houroffset*#animatedhours#)

[offsety2]
measure=calc
formula=-1*minutesformula+160+#yposition2#

[meterbackground]
meter=image
imagename=background.png
x=#position1#
y=#yposition1#

[meterbackground2]
meter=image
imagename=background.png
x=#position2#
y=#yposition2#


[glasshours]
meter=image
imagename=glass.png
X=(#position1#-1)
Y=#yposition1#

[glassminutes]
meter=image
X=(#position2#-1)
y=#yposition2#
imagename=glass.png

[numbers12]
meter=image
imagename=#font#.png
x=(#position1#-5)
y=[hoursformula]
dynamicvariables=1
imagecrop=0,0,100,[offsety]

[numbersminutes]
meter=image
imagename=#font#minutes.png
x=#position2#
y=[minutesformula]
dynamicvariables=1
imagecrop=0,100,100,[offsety2]

[frame]
meter=image
imagename=frame.png
x=0
y=0

[string]
meter=string
measurename=offsety2
y=170
fontsize=20
antialias=1
hidden=1

[shadowhours]
meter=image
imagename=shadow#shadow#.png
x=#position1#
y=#yposition1#

[shadowminutes]
meter=image
x=#position2#
y=#yposition2#
imagename=shadow#shadow#.png

[glasshoursover]
meter=image
imagename=glassover.png
X=(#position1#-1)
Y=#yposition1#

[glassminutesover]
meter=image
X=(#position2#-1)
y=#yposition2#
imagename=glassover.png


[Rainmeter]
Update=1000

[Variables]
HiddenInterval=5
ShownInterval=60
Interval=#ShownInterval#

[MeasureTime]
Measure=Time
Format=%#H:%M:%S

[MeasureInterval]
Measure=Calc
Formula=(( MeasureInterval + 1 ) % #Interval# )
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!SetVariable Interval "((#Interval#=#ShownInterval#)?#HiddenInterval#:#ShownInterval#)"][!ToggleFade]
DynamicVariables=1

[MeterTime]
Meter=STRING
MeasureName=MeasureTime
X=0
Y=0
Padding=25,15,25,15
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=28
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=%1
User avatar
David8192
Posts: 216
Joined: July 8th, 2021, 11:30 pm
Location: The King's Avenue, Golden Kingdom

Re: How to display UI items in set intervals

Post by David8192 »

TheDrifter76 wrote: January 15th, 2022, 4:48 pm since I've pasted the code, I havn't seen the clock once. Did I do it right? (using ScrollTime btw)

Code: Select all

[rainmeter]
Author= Manuel Vrhovac (manci5.deviantart.com)
update=1000

[Metadata]
Name=
Author=
Information=
License=
Version=

[variables]

;				Do you want animated hours too?
	AnimatedHours=0
	AnimatedMinutes=1
;				MyriadPro or LucidaGrande font?
	Font=MyriadPro
;				Dark or Light shadow?
	Shadow=Dark





position1=11
position2=113
yposition1=10
yposition2=10
offset=[hoursformula]

[hour]
measure=time
format=%I

[seconds]
measure=time
format=%S

[minutes]
measure=time
format=%M

[houroffset]
measure=calc
formula=minutes*0.58

[hoursformula]
measure=calc
formula=(hour*(-70))+54-(houroffset*#animatedhours#)

[minutesformula]
measure=calc
formula=4+minutes*(-70)+(((seconds-30)*(-1.16)+35)*#animatedminutes#)+#yposition2#

[offsety]
measure=calc
formula=120-(hour*(-70))+(houroffset*#animatedhours#)

[offsety2]
measure=calc
formula=-1*minutesformula+160+#yposition2#

[meterbackground]
meter=image
imagename=background.png
x=#position1#
y=#yposition1#

[meterbackground2]
meter=image
imagename=background.png
x=#position2#
y=#yposition2#


[glasshours]
meter=image
imagename=glass.png
X=(#position1#-1)
Y=#yposition1#

[glassminutes]
meter=image
X=(#position2#-1)
y=#yposition2#
imagename=glass.png

[numbers12]
meter=image
imagename=#font#.png
x=(#position1#-5)
y=[hoursformula]
dynamicvariables=1
imagecrop=0,0,100,[offsety]

[numbersminutes]
meter=image
imagename=#font#minutes.png
x=#position2#
y=[minutesformula]
dynamicvariables=1
imagecrop=0,100,100,[offsety2]

[frame]
meter=image
imagename=frame.png
x=0
y=0

[string]
meter=string
measurename=offsety2
y=170
fontsize=20
antialias=1
hidden=1

[shadowhours]
meter=image
imagename=shadow#shadow#.png
x=#position1#
y=#yposition1#

[shadowminutes]
meter=image
x=#position2#
y=#yposition2#
imagename=shadow#shadow#.png

[glasshoursover]
meter=image
imagename=glassover.png
X=(#position1#-1)
Y=#yposition1#

[glassminutesover]
meter=image
X=(#position2#-1)
y=#yposition2#
imagename=glassover.png


[Rainmeter]
Update=1000

[Variables]
HiddenInterval=5
ShownInterval=60
Interval=#ShownInterval#

[MeasureTime]
Measure=Time
Format=%#H:%M:%S

[MeasureInterval]
Measure=Calc
Formula=(( MeasureInterval + 1 ) % #Interval# )
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!SetVariable Interval "((#Interval#=#ShownInterval#)?#HiddenInterval#:#ShownInterval#)"][!ToggleFade]
DynamicVariables=1

[MeterTime]
Meter=STRING
MeasureName=MeasureTime
X=0
Y=0
Padding=25,15,25,15
FontColor=220,220,220
FontEffectColor=0,0,0
StringEffect=Shadow
SolidColor=0,0,0,150
FontSize=28
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=%1
Okay. Do this. Open your skin in the text editor, press CTRL+A then BACKSPACE (I mean, delete everything). Now, copy what is down here and paste it in the skin and SAVE it. Refresh Rainmeter and it will start working.

Code: Select all

[rainmeter]
Author= Manuel Vrhovac (manci5.deviantart.com)
update=1000

[Metadata]
Name=
Author=
Information=
License=
Version=

[variables]

;				Do you want animated hours too?
	AnimatedHours=0
	AnimatedMinutes=1
;				MyriadPro or LucidaGrande font?
	Font=MyriadPro
;				Dark or Light shadow?
	Shadow=Dark





position1=11
position2=113
yposition1=10
yposition2=10
offset=[hoursformula]

HiddenInterval=5
ShownInterval=60
Interval=#ShownInterval#


[hour]
measure=time
format=%I

[seconds]
measure=time
format=%S

[minutes]
measure=time
format=%M

[houroffset]
measure=calc
formula=minutes*0.58

[hoursformula]
measure=calc
formula=(hour*(-70))+54-(houroffset*#animatedhours#)

[minutesformula]
measure=calc
formula=4+minutes*(-70)+(((seconds-30)*(-1.16)+35)*#animatedminutes#)+#yposition2#

[offsety]
measure=calc
formula=120-(hour*(-70))+(houroffset*#animatedhours#)

[offsety2]
measure=calc
formula=-1*minutesformula+160+#yposition2#

[meterbackground]
meter=image
imagename=background.png
x=#position1#
y=#yposition1#

[meterbackground2]
meter=image
imagename=background.png
x=#position2#
y=#yposition2#


[glasshours]
meter=image
imagename=glass.png
X=(#position1#-1)
Y=#yposition1#

[glassminutes]
meter=image
X=(#position2#-1)
y=#yposition2#
imagename=glass.png

[numbers12]
meter=image
imagename=#font#.png
x=(#position1#-5)
y=[hoursformula]
dynamicvariables=1
imagecrop=0,0,100,[offsety]

[numbersminutes]
meter=image
imagename=#font#minutes.png
x=#position2#
y=[minutesformula]
dynamicvariables=1
imagecrop=0,100,100,[offsety2]

[frame]
meter=image
imagename=frame.png
x=0
y=0

[string]
meter=string
measurename=offsety2
y=170
fontsize=20
antialias=1
hidden=1

[shadowhours]
meter=image
imagename=shadow#shadow#.png
x=#position1#
y=#yposition1#

[shadowminutes]
meter=image
x=#position2#
y=#yposition2#
imagename=shadow#shadow#.png

[glasshoursover]
meter=image
imagename=glassover.png
X=(#position1#-1)
Y=#yposition1#

[glassminutesover]
meter=image
X=(#position2#-1)
y=#yposition2#
imagename=glassover.png


[MeasureInterval]
Measure=Calc
Formula=(( MeasureInterval + 1 ) % #Interval# )
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!SetVariable Interval "((#Interval#=#ShownInterval#)?#HiddenInterval#:#ShownInterval#)"][!ToggleFade]
DynamicVariables=1

I have used your code and just removed the unnecessary parts and duplicate sections.
the DA GALLERY 8-) For some Reason, the square root of X2 does not involve X
User avatar
balala
Rainmeter Sage
Posts: 13719
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to display UI items in set intervals

Post by balala »

TheDrifter76 wrote: January 15th, 2022, 4:48 pm since I've pasted the code, I havn't seen the clock once. Did I do it right? (using ScrollTime btw)
What have you missed and has been fixed by David8192 above, is the HiddenInterval, ShownInterval and Interval variables within the [Variables] section, which have been forgotten. Add them to the code and the skin will start properly working:

Code: Select all

[Variables]
...
HiddenInterval=600
ShownInterval=10
Interval=#ShownInterval#
(obviously don't change the other variables).

Additional note: even if this is not extremely important (and this is related to both, your and David8192's code), note that the Author option doesn't belong anymore to the [Rainmeter] section, but to [Metadata]. Even if a while ago it was there, it has been deprecated in this section. Yep, using / adding it to [Rainmeter] doesn't create problems, however strictly speaking, it should be used on the [Metadata] section. In both codes there is an Author option on [Metadata], but this is empty, while the Author on [Rainmeter] section is completed. Again, not a too important thing, however...
User avatar
David8192
Posts: 216
Joined: July 8th, 2021, 11:30 pm
Location: The King's Avenue, Golden Kingdom

Re: How to display UI items in set intervals

Post by David8192 »

balala wrote: January 16th, 2022, 11:01 am Additional note: even if this is not extremely important (and this is related to both, your and David8192's code), note that the Author option doesn't belong anymore to the [Rainmeter] section, but to [Metadata]. Even if a while ago it was there, it has been deprecated in this section. Yep, using / adding it to [Rainmeter] doesn't create problems, however strictly speaking, it should be used on the [Metadata] section. In both codes there is an Author option on [Metadata], but this is empty, while the Author on [Rainmeter] section is completed. Again, not a too important thing, however...
:D Sure thing. I kinda overlooked it, but you are right. It's good practice to put it in the right section.
the DA GALLERY 8-) For some Reason, the square root of X2 does not involve X
User avatar
balala
Rainmeter Sage
Posts: 13719
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to display UI items in set intervals

Post by balala »

David8192 wrote: January 16th, 2022, 11:47 am :D Sure thing. I kinda overlooked it, but you are right. It's good practice to put it in the right section.
Right, even if has not too much importance, as said.