It is currently May 3rd, 2024, 10:24 pm

SetVariable not updating the way I think it's supposed to

Get help with creating, editing & fixing problems with skins
grkblood13
Posts: 2
Joined: January 17th, 2013, 4:24 pm

SetVariable not updating the way I think it's supposed to

Post by grkblood13 »

I'm expecting "6" to be displayed but instead I'm seeing "3" which is telling me I'm using !SetVariable improperly. What would be the correct way to do this?

[Variables]
var=3

[MyMeter]
DynamicVariables=1
Meter=String
MeterStyle=TextStyle
SolidColor=255,255,255,255
BackgroundMode=2
!SetVariable var (#var#+3)
Text=#var#
X=0
Y=0
W=50
H=50
User avatar
lysy1993lbn
Posts: 291
Joined: July 25th, 2011, 9:53 am
Location: Lublin, Poland

Re: SetVariable not updating the way I think it's supposed t

Post by lysy1993lbn »

Yo have to assign !SetVariable to some action (ex. mouse hover)
"Never argue with an idiot, he will drag you down to his level and beat you with experience."
my deviantART | Alternative Rainmeter tray icons
grkblood13
Posts: 2
Joined: January 17th, 2013, 4:24 pm

Re: SetVariable not updating the way I think it's supposed t

Post by grkblood13 »

Is there a way to achieve what I'm trying to do that updates the variable on it's own using some other method?
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: SetVariable not updating the way I think it's supposed t

Post by eclectic-tech »

In your example, it appears you want to add 3 to the #var# value...
You should use a Calc Measure to do this...

I included 2 formulas:
The first one adds 3 to the value of #var# and displays it ("6")...
The second one adds the value of #var# on each update ("3, 6, 9,...") until refreshed.
The FinishAction= sets the variable to the new calculated value.
Un-comment (remove ";") the second formula and comment out (add ";") the first formula to see the difference.

Since X & Y default to zero, you do not need those settings.
By adding the MeasureName=, the meter will display that value without the need for Text= unless
you want to add to the value: Text=The current count is %1

Code: Select all

[Rainmeter]
Update=1000

[Variables]
var=3

[mAddThree]
Measure=Calc
Formula=(#var#+3)
;Formula=(mAddThree+#var#)
FinishAction=[!SetVariable var [mAddThree]]
DynamicVariables=1

[MyMeter]
DynamicVariables=1
Meter=String
MeterStyle=TextStyle
MeasureName=mAddThree
SolidColor=255,255,255,255
BackgroundMode=2
;Text=#var#
;X=0
;Y=0
W=50
H=50