It is currently April 24th, 2024, 12:46 pm

String meter won't update

Get help with creating, editing & fixing problems with skins
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: String meter won't update

Post by sl23 »

Aha! :D Thank you.

But how does that help to resolve my variant timer skin? :oops:
I'll take a look see if I can figure out how escaping a variable might be the answer ;-)
- MuLab -
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: String meter won't update

Post by jsmorley »

The important point to take out of this is that all #Variables# are "resolved" where they are used.

In this case, it matters whether the variable is resolved in the bang, before it is set as the value of the Text option on the meter, or whether the variable is resolved in the meter itself. If you don't escape the variable in the bang, it will be resolved there, and in my example the value of the Text option will be set to Text=Red. It will STAY Text=Red, forever... If you do escape the variable in the bang, then the literal #SomeVariable# will be set on the Text option, the Text option will then be Text=#SomeVariable#, and the variable will be resolved in the meter, changing when the value of the variable changes.

The point of the * (escape) is to say "Don't resolve this variable! Treat it as a literal string!".
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: String meter won't update

Post by death.crafter »

sl23 wrote: October 19th, 2021, 4:32 pm Aha! :D Thank you.

But how does that help to resolve my variant timer skin? :oops:
I'll take a look see if I can figure out how escaping a variable might be the answer ;-)

Code: Select all

LeftMouseUpAction=

[!SetOptionGroup Button FillAlpha "Fill Color #Color5#"]
[!SetOption #CURRENTSECTION# FillAlpha "Fill Color #Color2#"]

[!WriteKeyValue Variables Act "[#[#CURRENTSECTION]]"]
[!WriteKeyValue Variables ActionText [#CURRENTSECTION]]

[!SetVariable Act "[#[#CURRENTSECTION]]"]
[!SetVariable ActionText [#CURRENTSECTION]]

[!UpdateMeter *][!Redraw]
So this doesn't work? If it doesn't then we misunderstood what you are trying to do.
eclectic-tech wrote: October 19th, 2021, 2:37 pm
LeftMouseUpAction=[!SetOptionGroup Button FillAlpha "Fill Color #Color5#"][!SetOption #CURRENTSECTION# FillAlpha "Fill Color #Color2#"][!WriteKeyValue Variables Act "[#[#CURRENTSECTION#]]"] [!WriteKeyValue Variables ActionText [#CURRENTSECTION]] [!SetVariable Act "[#[#CURRENTSECTION#]]"] [!SetVariable ActionText [#CURRENTSECTION]][!UpdateMeter *][!Redraw]
[#[#CURRENTSECTION#]]

[#[#CURRENTSECTION]]

Probably a typo :D
from the Realm of Death
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: String meter won't update

Post by death.crafter »

jsmorley wrote: October 19th, 2021, 4:37 pm The important point to take out of this is that all #Variables# are "resolved" where they are used.

In this case, it matters whether the variable is resolved in the bang, before it is set as the value of the Text option on the meter, or whether the variable is resolved in the meter itself. If you don't escape the variable in the bang, it will be resolved there, and in my example the value of the Text option will be set to Text=Red. It will STAY Text=Red, forever... If you do escape the variable in the bang, then the literal #SomeVariable# will be set on the Text option, the Text option will then be Text=#SomeVariable#, and the variable will be resolved in the meter, changing when the value of the variable changes.

The point of the * (escape) is to say "Don't resolve this variable! Treat it as a literal string!".
I don't think he wants to escape that variable. From his previous replies I think his variable isn't getting resolved due to some reason, or resolved to something else.
from the Realm of Death
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: String meter won't update

Post by jsmorley »

death.crafter wrote: October 19th, 2021, 4:42 pm I don't think he wants to escape that variable. From his previous replies I think his variable isn't getting resolved due to some reason, or resolved to something else.
That's as may be. I have not followed this thread really. I was just reacting to what I perceived to be some confusion about what "escaping" variables and section variables is used for.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: String meter won't update

Post by death.crafter »

jsmorley wrote: October 19th, 2021, 4:45 pm That's as may be. I have not followed this thread really. I was just reacting to what I perceived to be some confusion about what "escaping" variables and section variables is used for.
Ahh, sorry for butting in :oops:
from the Realm of Death
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: String meter won't update

Post by sl23 »

@jsmorley: I see, thanks, I'll have to reread this probably so I'll bookmark it :lol:

@death.crafter: Well, that's the weird thing. It works in one skin, so I copied and pasted the LeftMouseUpAction into the second skin, but it doesn't work there. I did have to change the colour variable names, but that was all.

Works, but now the Actions have stopped working:

Code: Select all

[sButton]
Shape=Rectangle 0,0,10,10,50 | Extend FillAlpha | StrokeWidth 2 | Extend StrokeAlpha
FillAlpha=Fill Color #Color5#
StrokeAlpha=Stroke Color 128,255,0,0

LeftMouseUpAction=[!SetOptionGroup Button FillAlpha "Fill Color #Color5#"][!SetOption #CURRENTSECTION# FillAlpha "Fill Color #Color2#"][!WriteKeyValue Variables Act "[#[#CURRENTSECTION#]]"] [!WriteKeyValue Variables ActionText "#CURRENTSECTION#"] [!SetVariable Act "[#[#CURRENTSECTION#]]"][!SetVariable ActionText "#CURRENTSECTION#"][!UpdateMeter *][!Redraw]

MouseOverAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color 255,255,0,255"] [!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeAlpha ""] [!UpdateMeter *] [!Redraw] 

ToolTipText=[#CURRENTSECTION]

DynamicVariables=1
Group=Button
Hidden=1
MouseActionCursor=0
UpdateDivider=-1
X=20r
Y=r

[CloseApps]
Meter=Shape
MeterStyle=sButton
X=72
Y=8
Doesn't work:

Code: Select all

[sButton]
Shape=Rectangle 0,0,8,8,5 | Extend FillAlpha | StrokeWidth 2 | Extend StrokeAlpha
FillAlpha=Fill Color #White60#
StrokeAlpha=Stroke Color #Trans#

LeftMouseUpAction=[!SetOptionGroup Button FillAlpha "Fill Color #White60#"][!SetOption #CURRENTSECTION# FillAlpha "Fill Color #Red#"][!WriteKeyValue Variables Act "[#[#CURRENTSECTION#]]"] [!WriteKeyValue Variables ActionText "#CURRENTSECTION#"] [!SetVariable Act "[#[#CURRENTSECTION#]]"][!SetVariable ActionText "#CURRENTSECTION#"][!UpdateMeter *][!Redraw]

MouseOverAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color #White#"] [!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeAlpha ""] [!UpdateMeter *] [!Redraw] 

ToolTipText=[#CURRENTSECTION]
DynamicVariables=1
Group=Button
Hidden=1
UpdateDivider=-1
X=3R
Y=r
Basically, there's a set of buttons that select a function or action to be taken upon timer reaching zero. There is another meter that tells which button is selected so you know which action is to be taken when the settings, buttons, are closed. This text meter is NOT updated unless the skin is refreshed, which I don't want. The !WriteKey is used to permanently set this, but I am trying to use the !SetVariables to change the meter without a skin refresh. Hopefully that explains my intention?

Does the order of these bangs make a difference?
Last edited by sl23 on October 19th, 2021, 5:01 pm, edited 1 time in total.
- MuLab -
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: String meter won't update

Post by sl23 »

death.crafter wrote: October 19th, 2021, 4:47 pm Ahh, sorry for butting in :oops:
No you're not butting in, you have been a great help now and in the past, I thank you for any input.

The thing about using correct syntax for Nesting variables was useful, I just found it broke things when I tried to change skins to that way, I was being lazy so I left it! :oops:
- MuLab -
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: String meter won't update

Post by eclectic-tech »

@ death.crafter Yeah, that was a typo, but it works either using standard variable or nested in that portion of the bang :oops:

The alternate skin sl23 posted earlier also has a typo in [sButton]; you wrote different values for the #Act# variable in the !WriteKeyValue bang and the !SetVariable bang.

The reason the text doesn't update in that skin is due to not having DynamicVariables=1 in the [Action] section message.

Make changes to these 2 sections and it should update the action message.

Code: Select all

;========================================
; Message
;========================================
[Action]
Meter=String
MeterStyle=sAllText
FontSize=9
FontColor=#ActionFont#
Text=#ActionText#
X=30
Y=66
DynamicVariables=1


; {trimmed code}


[sButton]
Shape=Rectangle 0,0,8,8,5 | Extend FillAlpha | StrokeWidth 2 | Extend StrokeAlpha
FillAlpha=Fill Color #White60#
StrokeAlpha=Stroke Color #Trans#

LeftMouseUpAction=[!SetOptionGroup Button FillAlpha "Fill Color #White60#"][!SetOption #CURRENTSECTION# FillAlpha "Fill Color #Red#"][!WriteKeyValue Variables Act "[#[#CURRENTSECTION]]"] [!WriteKeyValue Variables ActionText [#CURRENTSECTION]] [!SetVariable Act "[#[#CURRENTSECTION]]"][!SetVariable ActionText "[#CURRENTSECTION]"][!UpdateMeter *][!Redraw]

MouseOverAction=[!SetOption #CURRENTSECTION# StrokeAlpha "StrokeColor #White#"] [!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeAlpha ""] [!UpdateMeter *] [!Redraw] 

ToolTipText=[#CURRENTSECTION]
DynamicVariables=1
Group=Button
Hidden=1
UpdateDivider=-1
X=3R
Y=r
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: String meter won't update

Post by sl23 »

Thank you all for you help, problem solved :thumbup:
- MuLab -