It is currently April 25th, 2024, 3:34 am

Show Hide Fps

Get help with creating, editing & fixing problems with skins
User avatar
sam0s
Posts: 6
Joined: October 30th, 2020, 1:01 am
Location: France

Show Hide Fps

Post by sam0s »

Hi everyone ! I'm Sam, a community newcomer
I just created an account because I have to ask you guys for some help, how can I hide my fps counter skin when it mesures 0 FPS and show it again when it is over 1
At first it sound kinda easy to do but I'm really struggling due to the fact that I'm a total noob, I'm pretty sure it's doable for someone who knows shit
I'm just pasting my skin here under

Code: Select all

[Rainmeter]
Update=1000

[Variables]
skin.Style=Horizontal

@include=#@#variables.ini
@include2=#@#include\MeterStyles.inc

[MeasureMSIAfterburnerFramerate]
Measure=Plugin
Plugin=Plugins\MSIAfterburner.dll
DataSource=Framerate
MinValue=1
MaxValue=100000

[Subtitle2]
Meter=STRING
MeterStyle=StyleValue
MeasureName=MeasureMSIAfterburnerFramerate
StringAlign=Right
Postfix=" FPS"
fontsize=32
y=2
x=195
Postfix=[\x00B0]
Hidden=0

[dontwork]
IfCondition=MeasureMSIAfterburnerFramerate = 0
IfTrueAction=[!SetOption Subtitle2 Hidden="1"]
IfCondition2=MeasureMSIAfterburnerFramerate > 1
IfTrueAction2=[!SetOption Subtitle2 Hidden="0"]
OnUpdateAction=[!UpdateMeter Subtitle2][!Redraw]
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Show Hide Fps

Post by eclectic-tech »

sam0s wrote: October 30th, 2020, 1:15 am Hi everyone ! I'm Sam, a community newcomer
I just created an account because I have to ask you guys for some help, how can I hide my fps counter skin when it mesures 0 FPS and show it again when it is over 1
At first it sound kinda easy to do but I'm really struggling due to the fact that I'm a total noob, I'm pretty sure it's doable for someone who knows shit
I'm just pasting my skin here under

Code: Select all

[Rainmeter]
Update=1000

[Variables]
skin.Style=Horizontal

@include=#@#variables.ini
@include2=#@#include\MeterStyles.inc

[MeasureMSIAfterburnerFramerate]
Measure=Plugin
Plugin=Plugins\MSIAfterburner.dll
DataSource=Framerate
MinValue=1
MaxValue=100000

[Subtitle2]
Meter=STRING
MeterStyle=StyleValue
MeasureName=MeasureMSIAfterburnerFramerate
StringAlign=Right
Postfix=" FPS"
fontsize=32
y=2
x=195
Postfix=[\x00B0]
Hidden=0

[dontwork]
IfCondition=MeasureMSIAfterburnerFramerate = 0
IfTrueAction=[!SetOption Subtitle2 Hidden="1"]
IfCondition2=MeasureMSIAfterburnerFramerate > 1
IfTrueAction2=[!SetOption Subtitle2 Hidden="0"]
OnUpdateAction=[!UpdateMeter Subtitle2][!Redraw]
Welcome Sam :welcome:

Add the IfConditon tests to the [MeasureMSIAfterburnerFramerate] measure section and set the MinValue to zero.

Code: Select all

[MeasureMSIAfterburnerFramerate]
Measure=Plugin
Plugin=Plugins\MSIAfterburner.dll
DataSource=Framerate
MinValue=0
MaxValue=100000
IfCondition=(#CurrentSection#>0)
IfTrueAction=[!ShowMeter Subtitle2][!UpdateMeter Subtitle2][!Redraw]
IfFalseAction=[!HideMeter Subtitle2][!UpdateMeter Subtitle2][!Redraw]
This will test if the frame rate is above zero and show the when it is or hide the meter when it equals zero.
Remove your [dontwork] section.
You also have 2 'PostFix=' lines in [Subtitle2] meter section, so remove one of them, since the second one will be ignored.
User avatar
sam0s
Posts: 6
Joined: October 30th, 2020, 1:01 am
Location: France

Re: Show Hide Fps

Post by sam0s »

It worked like a charm !
You cured my headache, thanks a lot, I mean it :D
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Show Hide Fps

Post by balala »

sam0s wrote: October 30th, 2020, 1:15 am how can I hide my fps counter skin when it mesures 0 FPS and show it again when it is over 1
Based on the above original request, I'd say better would be to hide the whole skin, not just a meter, as eclectic-tech proposed. At least this is my thought, based on the above request. If interested, this is how eclectic-tech's IfTrueAction / IfFalseAction options should be modified in order to do what I described above (hide or show the whole skin):

Code: Select all

[MeasureMSIAfterburnerFramerate]
...
IfCondition=(#CurrentSection#>0)
IfTrueAction=[!ShowFade]
IfFalseAction=[!HideFade]
Additionally if you prefer, !Show / !Hide bangs could be used instead of !ShowFade / !HideFade. The last set shows / hides the skin with a fade effect, while the !Show / !Hide bangs shows / hides the skin directly, with no such fade effect.
User avatar
sam0s
Posts: 6
Joined: October 30th, 2020, 1:01 am
Location: France

Re: Show Hide Fps

Post by sam0s »

balala wrote: October 30th, 2020, 4:52 pm
Based on the above original request, I'd say better would be to hide the whole skin
Yes ! I guess it's a cleaner code like this, also thanks for the fading effect tip ;-)
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Show Hide Fps

Post by balala »

sam0s wrote: November 4th, 2020, 3:57 pm Yes ! I guess it's a cleaner code like this, also thanks for the fading effect tip ;-)
No, it's not necessarly cleaner, it just does other things than eclectic-tech's code. His code hides / shows some meters of the skin, while my code hides / shows the whole skin. Additionally yes, the !Show / !Hide / !Toggle bangs have a fade effect version, !ShowFade / !HideFade / !ToggleFade (which me personally always prefer in front of the not-fading bangs).
I'm glad if you got it working as expected.