It is currently March 29th, 2024, 7:09 am

Escaping variables (or some sort)

Get help with creating, editing & fixing problems with skins
User avatar
EnhancedJax
Posts: 19
Joined: October 17th, 2020, 11:57 am

Escaping variables (or some sort)

Post by EnhancedJax »

Code: Select all

[Rainmeter]
Update=100

[Variables]
Scale=1
Width=(10*#Scale#)

[Loop]
Measure=Calc
OnUpdateAction=[!SetVariable Scale (#Scale#+0.1)][!UpdateMeter Item]
DynamicVariables=1

[Item]
Meter=Image
MeterStyle=2
SolidCOlor=255,0,0
DynamicVariables=1
[1]
W=(#Scale#*10)
H=(#Scale#*10)
[2]
W=#Width#
H=#Width#
Currently 1 works, but I want 2 to work in the same way as one does. Any ideas? :confused:
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Escaping variables (or some sort)

Post by Yincognito »

EnhancedJax wrote: August 7th, 2021, 1:13 pmCurrently 1 works, but I want 2 to work in the same way as one does. Any ideas? :confused:
You have 2 choices:

1. Add a [!SetVariable Width (10*#Scale#)] to the OnUpdateAction, to correspondingly set Width as well:

Code: Select all

[Rainmeter]
Update=100

[Variables]
Scale=1
Width=(10*#Scale#)

[Loop]
Measure=Calc
OnUpdateAction=[!SetVariable Scale (Clamp(#Scale#+0.1,1,10))][!SetVariable Width (10*#Scale#)][!UpdateMeter Item]
DynamicVariables=1

[Item]
Meter=Image
W=#Width#
H=#Width#
SolidColor=255,0,0
DynamicVariables=1
2. Use nested syntax when setting Width in [Variables] to let Rainmeter automatically do its dynamic setting, but very important, place defining the Width before defining the Scale (alternatively, you could place it afterwards, if you escape the Scale variable, like Width=(10*[#*Scale*])):

Code: Select all

[Rainmeter]
Update=100

[Variables]
Width=(10*[#Scale])
Scale=1

[Loop]
Measure=Calc
OnUpdateAction=[!SetVariable Scale (Clamp(#Scale#+0.1,1,10))][!UpdateMeter Item]
DynamicVariables=1

[Item]
Meter=Image
W=#Width#
H=#Width#
SolidColor=255,0,0
DynamicVariables=1
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
EnhancedJax
Posts: 19
Joined: October 17th, 2020, 11:57 am

Re: Escaping variables (or some sort)

Post by EnhancedJax »

Thankyou! The solutions are wonderful :D
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Escaping variables (or some sort)

Post by Yincognito »

EnhancedJax wrote: August 8th, 2021, 7:50 am Thankyou! The solutions are wonderful :D
No problem - glad to help. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth