It is currently March 29th, 2024, 12:46 pm

MoveMeter not showing my meter

Get help with creating, editing & fixing problems with skins
Deofol
Posts: 19
Joined: February 19th, 2020, 6:29 am

Re: MoveMeter not showing my meter

Post by Deofol »

Yincognito wrote: February 27th, 2020, 3:36 am Yes, you can. I'm on mobile now and can't post a reliably tested code, but you'd have a variable holding the number of order of the action, then on click you would simply update a Calc measure (that increments the measure based on the variable, for example) where you can attach as many IfConditons as needed to execute actions based on the value of that measure. Of course, the variable should be set to the value of the measure as well.

Or, you can use just the UpdateDivider=-1 Calc measure, and no variable at all, like in this basic sample below, edited on arrival to my computer:

Code: Select all

[Variables]

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

---Measures---

[MeasureExecuteSpecificActionSet]
Measure=Calc
Formula=((MeasureExecuteSpecificActionSet+1)%3)
UpdateDivider=-1
IfCondition=(MeasureExecuteSpecificActionSet=0)
IfTrueAction=[!SetOption MeasureActionSetResult String "Hello!"][!UpdateMeasure "MeasureActionSetResult"][!UpdateMeter *][!Redraw]
IfCondition2=(MeasureExecuteSpecificActionSet=1)
IfTrueAction2=[!SetOption MeasureActionSetResult String "There!"][!UpdateMeasure "MeasureActionSetResult"][!UpdateMeter *][!Redraw]
IfCondition3=(MeasureExecuteSpecificActionSet=2)
IfTrueAction3=[!SetOption MeasureActionSetResult String "Folks!"][!UpdateMeasure "MeasureActionSetResult"][!UpdateMeter *][!Redraw]
IfConditionMode=1

[MeasureActionSetResult]
Measure=String
String=
UpdateDivider=-1

---Meters---

[MeterClickHere]
Meter=String
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontWeight=700
AntiAlias=1
Text="CLICK HERE"
LeftMouseUpAction=[!UpdateMeasure "MeasureExecuteSpecificActionSet"]

[MeterToExecuteDifferentSetsOfActions]
Meter=String
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
X=0R
MeasureName=MeasureExecuteSpecificActionSet
MeasureName2=MeasureActionSetResult
Text="to execute set %1 of actions. Action set result = %2"
Really nice! Thanks a lot! That'll be pretty helpful :)
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: MoveMeter not showing my meter

Post by Yincognito »

Deofol wrote: February 27th, 2020, 3:07 pm Really nice! Thanks a lot! That'll be pretty helpful :)
My pleasure.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MoveMeter not showing my meter

Post by balala »

Yincognito wrote: February 27th, 2020, 3:36 am Or, you can use just the UpdateDivider=-1 Calc measure, and no variable at all, like in this basic sample below
Or the workaround with a variable:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]
Action=0
NumOfActions=3

[MeasureExecuteSpecificActionSet]
Measure=Calc
Formula=#Action#
IfCondition=(MeasureExecuteSpecificActionSet=0)
IfTrueAction=[!SetOption MeasureActionSetResult String "Hello!"][!UpdateMeasure "MeasureActionSetResult"][!UpdateMeter "MeterClickHere"][!UpdateMeter "MeterToExecuteDifferentSetsOfActions"][!Redraw]
IfCondition2=(MeasureExecuteSpecificActionSet=1)
IfTrueAction2=[!SetOption MeasureActionSetResult String "There!"][!UpdateMeasure "MeasureActionSetResult"][!UpdateMeter "MeterClickHere"][!UpdateMeter "MeterToExecuteDifferentSetsOfActions"][!Redraw]
IfCondition3=(MeasureExecuteSpecificActionSet=2)
IfTrueAction3=[!SetOption MeasureActionSetResult String "Folks!"][!UpdateMeasure "MeasureActionSetResult"][!UpdateMeter "MeterClickHere"][!UpdateMeter "MeterToExecuteDifferentSetsOfActions"][!Redraw]
DynamicVariables=1

[MeasureActionSetResult]
Measure=String
UpdateDivider=-1

[MeterClickHere]
Meter=String
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontWeight=700
AntiAlias=1
Text=CLICK HERE
LeftMouseUpAction=[!SetVariable Action "((#Action#+1)%#NumOfActions#)"][!UpdateMeasure "MeasureExecuteSpecificActionSet"]
DynamicVariables=1
UpdateDivider=-1

[MeterToExecuteDifferentSetsOfActions]
Meter=String
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
X=0R
MeasureName=MeasureExecuteSpecificActionSet
MeasureName2=MeasureActionSetResult
Text=to execute set %1 of actions. Action set result = %2
UpdateDivider=-1
This is the same code as Yincognito's one, rewrote to work with the Action variable.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: MoveMeter not showing my meter

Post by Yincognito »

balala wrote: February 27th, 2020, 7:18 pmOr the workaround with a variable: [...]
Nice! :thumbup: I'm curious though: why the UpdateDivider=-1 on the meters? I mean, there isn't any danger of them incrementing the variable by mistake, since the action is "protected" by being in a LeftMouseUpAction (i.e. if you don't click the mouse, nothing "unintentional" happens). Not saying it's wrong this way or that it should be modified (after all, I like very much updating things only on demand using UpdateDivider=-1 on as much code as I can) - I was just curious about the reason behind it...
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MoveMeter not showing my meter

Post by balala »

Yincognito wrote: February 27th, 2020, 9:55 pm I'm curious though: why the UpdateDivider=-1 on the meters?
No special reason, I added those UpdateDivider options because there is no reason on updating those meters regularly. They have to be updated when the value of the #Action# variable is changing and accordingly the value of the [MeasureExecuteSpecificActionSet] measure is changing as well. In other situations there is no need for such updates of the meters, so I added those options. However as you seen, if you remove them, the skin work same way.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: MoveMeter not showing my meter

Post by jsmorley »

It should be noted that the "update" of a meter is very inexpensive indeed, and generally speaking shouldn't be something you concern yourself with, although it never hurts to be rigorous in fine-tuning. The more expensive part of the cycle that touches meters is the "redraw" of the skin, and that can only be controlled by the Update option in [Rainmeter].
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MoveMeter not showing my meter

Post by balala »

jsmorley wrote: February 28th, 2020, 3:18 pm The more expensive part of the cycle that touches meters is the "redraw" of the skin, and that can only be controlled by the Update option in [Rainmeter].
Or by a !Redraw bang, to be rigorous.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: MoveMeter not showing my meter

Post by Yincognito »

jsmorley wrote: February 28th, 2020, 3:18 pm It should be noted that the "update" of a meter is very inexpensive indeed, and generally speaking shouldn't be something you concern yourself with, although it never hurts to be rigorous in fine-tuning. The more expensive part of the cycle that touches meters is the "redraw" of the skin, and that can only be controlled by the Update option in [Rainmeter].
What about updating two meters (one 2 times, the other 1 time) with things like ClipStringW, X, Y and such (but while hidden)? I know the redraws are the heaviest in general, but does it matter how many times - in a row or not - you update meters? From a performance / time point of view.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: MoveMeter not showing my meter

Post by jsmorley »

Yincognito wrote: February 28th, 2020, 7:50 pm What about updating two meters (one 2 times, the other 1 time) with things like ClipStringW, X, Y and such (but while hidden)? I know the redraws are the heaviest in general, but does it matter how many times - in a row or not - you update meters? From a performance / time point of view.
In general, updating meters is very low-cost. It's mostly just internal and the amount of time it takes just rounds to zero. Updating measures is a tad more expensive as almost all of them go out and do something using a Windows API call or some other more external process. Redraw is the most expensive, as it does a lot of the sizing of images and such, and redraws the entire skin on each update.

I can't imagine any skin where doing extra updates of meters, without any extra redraws of the skin, would have any real impact at all.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: MoveMeter not showing my meter

Post by balala »

jsmorley wrote: February 29th, 2020, 12:41 am I can't imagine any skin where doing extra updates of meters, without any extra redraws of the skin, would have any real impact at all.
For instance this makes sense if there is a LeftMouseUpAction option set, which increments a variable and the value of that variable might change into another process as well. Such in a case, updating the meter without redrawing the skin might be important, to make it to immediately use the new value of the variable.
Otherwise there is indeed no reason of extra update of the meter.