It is currently March 29th, 2024, 10:55 am

Using Variables to increment/decrement/and run calculations

Get help with creating, editing & fixing problems with skins
dimentio64
Posts: 13
Joined: August 24th, 2015, 4:49 pm

Using Variables to increment/decrement/and run calculations

Post by dimentio64 »

I am Having issues getting this to properly work. The following is my code:

Code: Select all

[Measure_Level]
Measure=Calc
Formula=#Level#
DynamicVariables=1
and the activator

Code: Select all

LeftMouseDownAction=[!SetVariable Level "(#Level#-1)"]
This results in Level being the string "(#Level#-1)", unsurprising in my mind, but I'm following the syntax I saw indicated. I have tried several combinations of adding and removing " and # to the variable and definition. I also tried a static variable at the top instead and that had other weird issues involved... I'm assuming my syntax is just wrong here?
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Using Variables to increment/decrement/and run calculations

Post by jsmorley »

dimentio64 wrote:I am Having issues getting this to properly work. The following is my code:

Code: Select all

[Measure_Level]
Measure=Calc
Formula=#Level#
DynamicVariables=1
and the activator

Code: Select all

LeftMouseDownAction=[!SetVariable Level "(#Level#-1)"]
This results in Level being the string "(#Level#-1)", unsurprising in my mind, but I'm following the syntax I saw indicated. I have tried several combinations of adding and removing " and # to the variable and definition. I also tried a static variable at the top instead and that had other weird issues involved... I'm assuming my syntax is just wrong here?
Not sure I follow. This works fine for me:

Code: Select all

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

[Variables]
Level=5

[Measure_Level]
Measure=Calc
Formula=#Level#
DynamicVariables=1

[MeterOne]
Meter=String
MeasureName=Measure_Level
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
DynamicVariables=1
LeftMouseDownAction=[!SetVariable Level "(#Level#-1)"]
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Using Variables to increment/decrement/and run calculations

Post by CyberTheWorm »

Beat me to it, but I would change the line

Code: Select all

LeftMouseUpAction=[!SetVariable Level "(#Level#-1)"]
otherwise you can't drag the skin
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
dimentio64
Posts: 13
Joined: August 24th, 2015, 4:49 pm

Re: Using Variables to increment/decrement/and run calculations

Post by dimentio64 »

Ok, so that makes sense, I forgot the MeasureName=Measure_Level part... Problem is that I'm using a 'button' (roundline) and apparently adding the measurename dissolves the 'button'

Code: Select all

[draw_Ball0]
X=150
Y=150
W=40
H=40
Meter=roundline
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
LineLength=20
LineColor=146,222,148,255
Solid=1
AntiAlias=1
MeasureName=Measure_Level
LeftMouseDownAction=[!SetVariable Level "(#Level#-1)"]
edit: and by dissolves I mean it's not there anymore and can't be clicked
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Using Variables to increment/decrement/and run calculations

Post by CyberTheWorm »

dimentio64 wrote:Ok, so that makes sense, I forgot the MeasureName=Measure_Level part... Problem is that I'm using a 'button' (roundline) and apparently adding the measurename dissolves the 'button'

edit: and by dissolves I mean it's not there anymore and can't be clicked
Try this

Code: Select all

[draw_Ball0]
X=150
Y=150
W=40
H=40
Meter=roundline
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
LineLength=20
LineColor=146,222,148,255
Solid=1
AntiAlias=1
DynamicVariables=1
MeasureName=Measure_Level
LeftMouseUpAction=[!SetVariable Level "(#Level#-1)"]
You were missing the DynamicVariables=1
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Using Variables to increment/decrement/and run calculations

Post by CyberTheWorm »

Sorry I see it disappears when the Level get's to 0
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
dimentio64
Posts: 13
Joined: August 24th, 2015, 4:49 pm

Re: Using Variables to increment/decrement/and run calculations

Post by dimentio64 »

Thanks, I was missing that, but the button is still not loaded oddly enough. I don't see why including a measure for the roundline function seems to kill it...
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Using Variables to increment/decrement/and run calculations

Post by CyberTheWorm »

try taking this line out

Code: Select all

MeasureName=Measure_Level
That seems to work
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
dimentio64
Posts: 13
Joined: August 24th, 2015, 4:49 pm

Re: Using Variables to increment/decrement/and run calculations

Post by dimentio64 »

It looks like the issue is actually that I never initialized the value of #Level# to 0... -_-
Or rather I deleted the initialization when playing around trying to fix the bug... Thanks guys