It is currently March 28th, 2024, 8:41 pm

Increase bar clicking on button image?

Get help with creating, editing & fixing problems with skins
User avatar
GioRgSaVv
Posts: 62
Joined: February 7th, 2017, 10:02 pm

Re: Increase bar clicking on button image?

Post by GioRgSaVv »

Wait, I think I got it! I will just replace the bar with a png image that has already spaces between each box ;) ;)

I will complete it tomorrow then, too tired to do it now, once again, thanks for your time guys! :)
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5382
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Increase bar clicking on button image?

Post by eclectic-tech »

Using just the shape meters you had, adding a few variables, and a calc measure to track the count, you can reduce your code considerably and not have to use any images that need to be hidden/shown.

Code: Select all

[Rainmeter]
Update=100
BackgroundMode=2
BackgroundMargins=0,5,5,5
SolidColor=0,0,0,90
SolidColor2=160,0,0,130

[Variables]
Count=0
Color1=100,100,100
Color2=100,100,100
Color3=100,100,100
Color4=100,100,100
Color5=100,100,100

[CheckCount]
Measure=Calc
Formula=#Count#
DynamicVariables=1

IfCondition=(#Count# >= 1)
IfTrueAction=[!SetVariable Color1 "100,255,100"][!WriteKeyValue Variables Color1 "100,255,100"][!UpdateMeter Shape1][!Redraw]
IfFalseAction=[!SetVariable Color1 "100,100,100"][!WriteKeyValue Variables Color1 "100,100,100"][!UpdateMeter Shape1][!Redraw]

IfCondition2=(#Count# >= 2)
IfTrueAction2=[!SetVariable Color2 "100,255,100"][!WriteKeyValue Variables Color2 "100,255,100"][!UpdateMeter Shape2][!Redraw]
IfFalseAction2=[!SetVariable Color2 "100,100,100"][!WriteKeyValue Variables Color2 "100,100,100"][!UpdateMeter Shape2][!Redraw]

IfCondition3=(#Count# >= 3)
IfTrueAction3=[!SetVariable Color3 "100,255,100"][!WriteKeyValue Variables Color3 "100,255,100"][!UpdateMeter Shape3][!Redraw]
IfFalseAction3=[!SetVariable Color3 "100,100,100"][!WriteKeyValue Variables Color3 "100,100,100"][!UpdateMeter Shape3][!Redraw]

IfCondition4=(#Count# >= 4)
IfTrueAction4=[!SetVariable Color4 "100,255,100"][!WriteKeyValue Variables Color4 "100,255,100"][!UpdateMeter Shape4][!Redraw]
IfFalseAction4=[!SetVariable Color4 "100,100,100"][!WriteKeyValue Variables Color4 "100,100,100"][!UpdateMeter Shape4][!Redraw]

IfCondition5=(#Count# >= 5)
IfTrueAction5=[!SetVariable Color5 "100,255,100"][!WriteKeyValue Variables Color5 "100,255,100"][!UpdateMeter Shape5][!Redraw]
IfFalseAction5=[!SetVariable Color5 "100,100,100"][!WriteKeyValue Variables Color5 "100,100,100"][!UpdateMeter Shape5][!Redraw]


[Style]
FontFace=Proxima Nova Bold
FontColor=255,255,255
StringEffect=Shadow
FontSize=12
AntiAlias=1

[Title1]
Meter=String
Text=- Push Ups x10
MeterStyle=Style
Y=5
X=5

////////////// SHAPES /////////////

[Shape1]
Meter=Shape
Y=31
X=6
Shape=Rectangle 0,0,40,3 | StrokeWidth 1 | Stroke Color 0,0,0 | Fill Color #Color1#
DynamicVariables=1

[Shape2]
Meter=Shape
Y=r
X=3R
Shape=Rectangle 0,0,40,3 | StrokeWidth 1 | Stroke Color 0,0,0 | Fill Color #Color2#
DynamicVariables=1

[Shape3]
Meter=Shape
Y=r
X=3R
Shape=Rectangle 0,0,40,3 | StrokeWidth 1 | Stroke Color 0,0,0 | Fill Color #Color3#
DynamicVariables=1

[Shape4]
Meter=Shape
Y=r
X=3R
Shape=Rectangle 0,0,40,3 | StrokeWidth 1 | Stroke Color 0,0,0 | Fill Color #Color4#
DynamicVariables=1

[Shape5]
Meter=Shape
Y=r
X=3R
Shape=Rectangle 0,0,40,3 | StrokeWidth 1 | Stroke Color 0,0,0 | Fill Color #Color5#
DynamicVariables=1

///////////// MINUS ////////////////////////////////////

[BoxShapeM]
Meter=Shape
Y=6
X=182
Shape=Rectangle 0,0,18,18 | Fill LinearGradient MyGradient1 | StrokeWidth 1 | Stroke Color 0,0,0
MyGradient1=270 | 100,255,100 ; 0.0 | 20,160,20 ; 1.0
LeftMouseUpAction=[!SetVariable Count (Clamp(#Count#-1,0,5))][!WriteKeyValue Variables Count (Clamp(#Count#-1,0,5))][!UpdateMeter *][!Redraw]
DynamicVariables=1

[ButtonMinus]
Meter=String
FontFace=Proxima Nova Bold
FontColor240,240,240
FontSize=17
Text=-
Y=1
X=184

///////////// PLUS ////////////////////////////////////

[BoxShapePlus]
Meter=Shape
Y=6
X=204
Shape=Rectangle 0,0,18,18 | Fill LinearGradient MyGradient1 | StrokeWidth 1 | Stroke Color 0,0,0
MyGradient1=270 | 100,255,100 ; 0.0 | 20,160,20 ; 1.0
LeftMouseUpAction=[!SetVariable Count (Clamp(#Count#+1,0,5))][!WriteKeyValue Variables Count (Clamp(#Count#+1,0,5))][!UpdateMeter *][!Redraw]
DynamicVariables=1

[ButtonP]
Meter=String
FontFace=Proxima Nova Bold
FontColor240,240,240
FontSize=16
Text=+
Y=2
X=204

5step.gif
Hope this helps you understand the suggestions to use !WriteKeyValue. Along with the power of IfCondition tests. :)
You do not have the required permissions to view the files attached to this post.
User avatar
GioRgSaVv
Posts: 62
Joined: February 7th, 2017, 10:02 pm

Re: Increase bar clicking on button image?

Post by GioRgSaVv »

Thanks a lot for the code!
It looks like this now! I will add a text later and an animated image that will pop up when hit 100%. :)
Image

I actually used the bars method, seems kinda easier :P
That's the code.

Code: Select all

[Rainmeter]
Update=16
BackgroundMode=2
BackgroundMargins=0,5,5,5
SolidColor=0,0,0,0
SolidColor2=0,100,130,130

[Variables]
Current=60

[CurrentValue]
Measure=Calc
Formula=#Current#
MinValue=0
MaxValue=100
IfCondition=(#Current# <= 0)
IfTrueAction=[!SetVariable Current 0][!WriteKeyValue Variables Current 0][!UpdateMeter *][!Redraw]
IfCondition2=(#Current# >= 100)
IfTrueAction2=[!SetVariable Current 100][!WriteKeyValue Variables Current 100][!UpdateMeter *][!Redraw]
DynamicVariables=1

//////////// BARS ///////////////////

[EmptyBar]
Meter=Image
ImageName=Bar1.png
Y=30
X=5

[Bar]
Meter=Bar
MeasureName=CurrentValue
BarOrientation=Horizontal
BarImage=Bar.png
Y=30
X=5

///////////// RESET ///////////////////

[BoxReset]
Meter=Image
ImageName=Reset.png
Y=5
X=137
LeftMouseUpAction=[!SetVariable Current 0][!WriteKeyValue Variables Current 0][!UpdateMeter *][!Redraw]
DynamicVariables=1

//////////// MINUS /////////////////

[BoxMinus]
Meter=Image
ImageName=Minus.png
Y=5
X=159
LeftMouseUpAction=[!SetVariable Current "(#Current#-20)"][!WriteKeyValue Variables Current "(#Current#-20)"][!UpdateMeter *][!Redraw]
DynamicVariables=1


///////////// PLUS ////////////////////

[BoxPlus]
Meter=Image
ImageName=Plus1.png
Y=5
X=181
LeftMouseUpAction=[!SetVariable Current "(#Current#+20)"][!WriteKeyValue Variables Current "(#Current#+20)"][!UpdateMeter *][!Redraw]
DynamicVariables=1
But I ran into another problem, IfConditions don't work. Bar goes over than 100 and less than 0, I don't know how to fix it :/ Once again I need your help to fix it :confused:
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Increase bar clicking on button image?

Post by balala »

EDIT: Sorry this post is related to the first posted code, but probably the second one could be also modified this way.

I downloaded your package and gave it a try. Found a few mistakes and fixed them. Here is my code:

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=0,0,0,90
SolidColor2=160,0,0,130

[Variables]
Step=0

[Style]
FontFace=Proxima Nova Bold
FontColor=255,255,255
StringEffect=Shadow
FontSize=12
AntiAlias=1

[Title1]
Meter=String
Text=- Push Ups x10
MeterStyle=Style
Y=5
X=5

[Shape1]
Meter=Shape
Y=31
X=6
Shape=Rectangle 0,0,40,3 | Fill Color 0,0,0,0 | StrokeWidth 2 | Stroke Color 0,0,0

[Shape2]
Meter=Shape
Y=31
X=3R
Shape=Rectangle 0,0,40,3 | Fill Color 0,0,0,0 | StrokeWidth 2 | Stroke Color 0,0,0

[Shape3]
Meter=Shape
Y=31
X=3R
Shape=Rectangle 0,0,40,3 | Fill Color 0,0,0,0 | StrokeWidth 2 | Stroke Color 0,0,0

[Shape4]
Meter=Shape
Y=31
X=3R
Shape=Rectangle 0,0,40,3 | Fill Color 0,0,0,0 | StrokeWidth 2 | Stroke Color 0,0,0

[Shape5]
Meter=Shape
Y=31
X=3R
Shape=Rectangle 0,0,40,3 | Fill Color 0,0,0,0 | StrokeWidth 2 | Stroke Color 0,0,0

[BarEmpty1]
Meter=Image
ImageName=Bar2.png
Y=31
X=6

[BarEmpty2]
Meter=Image
ImageName=Bar2.png
Y=31
X=4R

[BarEmpty3]
Meter=Image
ImageName=Bar2.png
Y=31
X=4R

[BarEmpty4]
Meter=Image
ImageName=Bar2.png
Y=31
X=4R

[BarEmpty5]
Meter=Image
ImageName=Bar2.png
Y=31
X=4R

[MeasureStep]
Measure=Calc
Formula=#Step#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!HideMeter "Bar1"][!HideMeter "Bar2"][!HideMeter "Bar3"][!HideMeter "Bar4"][!HideMeter "Bar5"][!Redraw]
IfCondition2=(#CURRENTSECTION#=1)
IfTrueAction2=[!ShowMeter "Bar1"][!HideMeter "Bar2"][!HideMeter "Bar3"][!HideMeter "Bar4"][!HideMeter "Bar5"][!Redraw]
IfCondition3=(#CURRENTSECTION#=2)
IfTrueAction3=[!ShowMeter "Bar1"][!ShowMeter "Bar2"][!HideMeter "Bar3"][!HideMeter "Bar4"][!HideMeter "Bar5"][!Redraw]
IfCondition4=(#CURRENTSECTION#=3)
IfTrueAction4=[!ShowMeter "Bar1"][!ShowMeter "Bar2"][!ShowMeter "Bar3"][!HideMeter "Bar4"][!HideMeter "Bar5"][!Redraw]
IfCondition5=(#CURRENTSECTION#=4)
IfTrueAction5=[!ShowMeter "Bar1"][!ShowMeter "Bar2"][!ShowMeter "Bar3"][!ShowMeter "Bar4"][!HideMeter "Bar5"][!Redraw]
IfCondition6=(#CURRENTSECTION#=5)
IfTrueAction6=[!ShowMeter "Bar1"][!ShowMeter "Bar2"][!ShowMeter "Bar3"][!ShowMeter "Bar4"][!ShowMeter "Bar5"][!Redraw]
DynamicVariables=1

[BoxShapeM]
Meter=Shape
Y=6
X=182
Shape=Rectangle 0,0,18,18 | Fill Color 0,0,0,0 | StrokeWidth 2 | Stroke Color 0,0,0

[BoxMinus1]
Meter=Image
ImageName=Box.png
LeftMouseUpAction=[!SetVariable Step "(Clamp((#Step#-1),0,5))"][!UpdateMeasure "MeasureStep"][!UpdateMeterGroup "Buttons"]
Y=0r
X=0r
DynamicVariables=1
Group=Buttons

[ButtonMinus]
Meter=String
FontFace=Proxima Nova Bold
FontColor=240,240,240
FontSize=16
Text=-
Y=9r
X=9r
StringAlign=CenterCenter

[BoxShapePlus]
Meter=Shape
Y=6
X=204
Shape=Rectangle 0,0,18,18 | Fill Color 0,0,0,0 | StrokeWidth 2 | Stroke Color 0,0,0

[BoxPlus1]
Meter=Image
ImageName=Box.png
LeftMouseUpAction=[!SetVariable Step "(Clamp((#Step#+1),0,5))"][!UpdateMeasure "MeasureStep"][!UpdateMeterGroup "Buttons"]
Y=0r
X=0r
DynamicVariables=1
Group=Buttons

[ButtonP]
Meter=String
FontFace=Proxima Nova Bold
FontColor=240,240,240
FontSize=16
Text=+
X=9r
Y=9r
StringAlign=CenterCenter

[Bar1]
Meter=Image
ImageName=Bar1.png
X=6
Y=31
Hidden=1

[Bar2]
Meter=Image
ImageName=Bar1.png
X=4R
Y=0r
Hidden=1

[Bar3]
Meter=Image
ImageName=Bar1.png
X=4R
Y=0r
Hidden=1

[Bar4]
Meter=Image
ImageName=Bar1.png
X=4R
Y=0r
Hidden=1

[Bar5]
Meter=Image
ImageName=Bar1.png
X=4R
Y=0r
Hidden=1
Applied fixes:
  • The BackgroundMargins option in the [Rainmeter] section make sense only if the BackgroundMode option is set to 3. With BackgroundMode=2, it has no sens, so I removed it.
  • I added a [Variables] section and within it a Step variable: Step=0. This variable will be used to set the visible meters (see later).
  • Using so many [BoxMinusX] and [BoxPlusX] meters (5 of each) again has not too much logic. I removed most of them, leaving just the [BoxMinus1] and [BoxPlus1].
  • The FontColor options of the [ButtonMinus] and [ButtonP] meters (however I'd name the [ButtonP] meter as [ButtonPlus] - but this has not too much importance) are missing an equal sign:

    Code: Select all

    [ButtonMinus]
    ...
    FontColor240,240,240
    
    [ButtonMinus]
    ...
    FontColor240,240,240
    I added them back: FontColor[color=#FF0000]=[/color]240,240,240. Without the equality signs, the default color is used (black).
  • I repositioned the [ButtonMinus] and [ButtonP] meters:

    Code: Select all

    [ButtonMinus]
    ...
    Y=9r
    X=9r
    StringAlign=CenterCenter
    
    [ButtonP]
    ...
    X=9r
    Y=9r
    StringAlign=CenterCenter
  • I added the following Calc measure, which controls which meters are visible:

    Code: Select all

    [MeasureStep]
    Measure=Calc
    Formula=#Step#
    IfCondition=(#CURRENTSECTION#=0)
    IfTrueAction=[!HideMeter "Bar1"][!HideMeter "Bar2"][!HideMeter "Bar3"][!HideMeter "Bar4"][!HideMeter "Bar5"][!Redraw]
    IfCondition2=(#CURRENTSECTION#=1)
    IfTrueAction2=[!ShowMeter "Bar1"][!HideMeter "Bar2"][!HideMeter "Bar3"][!HideMeter "Bar4"][!HideMeter "Bar5"][!Redraw]
    IfCondition3=(#CURRENTSECTION#=2)
    IfTrueAction3=[!ShowMeter "Bar1"][!ShowMeter "Bar2"][!HideMeter "Bar3"][!HideMeter "Bar4"][!HideMeter "Bar5"][!Redraw]
    IfCondition4=(#CURRENTSECTION#=3)
    IfTrueAction4=[!ShowMeter "Bar1"][!ShowMeter "Bar2"][!ShowMeter "Bar3"][!HideMeter "Bar4"][!HideMeter "Bar5"][!Redraw]
    IfCondition5=(#CURRENTSECTION#=4)
    IfTrueAction5=[!ShowMeter "Bar1"][!ShowMeter "Bar2"][!ShowMeter "Bar3"][!ShowMeter "Bar4"][!HideMeter "Bar5"][!Redraw]
    IfCondition6=(#CURRENTSECTION#=5)
    IfTrueAction6=[!ShowMeter "Bar1"][!ShowMeter "Bar2"][!ShowMeter "Bar3"][!ShowMeter "Bar4"][!ShowMeter "Bar5"][!Redraw]
    DynamicVariables=1
    See that depending on the value of the Step variable (previously added to the [Variables] section), this measure sets the visible meters.
  • I modified the LeftMouseUpAction options of the remained [BoxMinus1] and [BoxPlus1] meters, added a DynamicVariables=1 and a Group=Buttons options to these meters and modified their position (X and Y options):

    Code: Select all

    [BoxMinus1]
    Meter=Image
    ImageName=Box.png
    LeftMouseUpAction=[!SetVariable Step "(Clamp((#Step#-1),0,5))"][!UpdateMeasure "MeasureStep"][!UpdateMeterGroup "Buttons"]
    Y=0r
    X=0r
    DynamicVariables=1
    Group=Buttons
    
    [BoxPlus1]
    Meter=Image
    ImageName=Box.png
    LeftMouseUpAction=[!SetVariable Step "(Clamp((#Step#+1),0,5))"][!UpdateMeasure "MeasureStep"][!UpdateMeterGroup "Buttons"]
    Y=0r
    X=0r
    DynamicVariables=1
    Group=Buttons
  • Made a few more smaller changes, like removed the comments (like ///////////// MINUS ////////////////////////////////////), but if you don't want to completely remove them, at least comment them out, using semicolons).
Please check this code and let me know how does it work.
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: Increase bar clicking on button image?

Post by kyriakos876 »

GioRgSaVv wrote:Thanks a lot for the code!
It looks like this now! I will add a text later and an animated image that will pop up when hit 100%. :)
Image

I actually used the bars method, seems kinda easier :P
That's the code.

Code: Select all

[Rainmeter]
Update=16
BackgroundMode=2
BackgroundMargins=0,5,5,5
SolidColor=0,0,0,0
SolidColor2=0,100,130,130

[Variables]
Current=60

[CurrentValue]
Measure=Calc
Formula=#Current#
MinValue=0
MaxValue=100
IfCondition=(#Current# <= 0)
IfTrueAction=[!SetVariable Current 0][!WriteKeyValue Variables Current 0][!UpdateMeter *][!Redraw]
IfCondition2=(#Current# >= 100)
IfTrueAction2=[!SetVariable Current 100][!WriteKeyValue Variables Current 100][!UpdateMeter *][!Redraw]
DynamicVariables=1

//////////// BARS ///////////////////

[EmptyBar]
Meter=Image
ImageName=Bar1.png
Y=30
X=5

[Bar]
Meter=Bar
MeasureName=CurrentValue
BarOrientation=Horizontal
BarImage=Bar.png
Y=30
X=5

///////////// RESET ///////////////////

[BoxReset]
Meter=Image
ImageName=Reset.png
Y=5
X=137
LeftMouseUpAction=[!SetVariable Current 0][!WriteKeyValue Variables Current 0][!UpdateMeter *][!Redraw]
DynamicVariables=1

//////////// MINUS /////////////////

[BoxMinus]
Meter=Image
ImageName=Minus.png
Y=5
X=159
LeftMouseUpAction=[!SetVariable Current "(#Current#-20)"][!WriteKeyValue Variables Current "(#Current#-20)"][!UpdateMeter *][!Redraw]
DynamicVariables=1


///////////// PLUS ////////////////////

[BoxPlus]
Meter=Image
ImageName=Plus1.png
Y=5
X=181
LeftMouseUpAction=[!SetVariable Current "(#Current#+20)"][!WriteKeyValue Variables Current "(#Current#+20)"][!UpdateMeter *][!Redraw]
DynamicVariables=1
But I ran into another problem, IfConditions don't work. Bar goes over than 100 and less than 0, I don't know how to fix it :/ Once again I need your help to fix it :confused:
There you go:

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
BackgroundMargins=0,5,5,5
SolidColor=0,0,0,0
SolidColor2=0,100,130,130

[Variables]
Current=0

[MeasurePlus]
Measure=Calc
Formula=(#Current#+20)
OnUpdateAction=[!SetVariable Current "[MeasurePlus]"][!WriteKeyValue Variables Current "[MeasurePlus]"][!UpdateMeter *][!Redraw]
DynamicVariables=1
MaxValue=100
UpdateDivider=-1

[MeasureMinus]
Measure=Calc
Formula=(#Current#-20)
OnUpdateAction=[!SetVariable Current "[MeasureMinus]"][!WriteKeyValue Variables Current "[MeasureMinus]"][!UpdateMeter *][!Redraw]
DynamicVariables=1
MinValue=0
UpdateDivider=-1
//////////// BARS ///////////////////

[EmptyBar]
Meter=Image
ImageName=#@#Bar1.png
Y=30
X=5

[Bar]
Meter=Bar
MeasureName=CurrentValue
BarOrientation=Horizontal
BarImage=#@#Bar.png
Y=30
X=5

///////////// RESET ///////////////////

[BoxReset]
Meter=Image
ImageName=#@#Reset.png
Y=5
X=137
LeftMouseUpAction=[!SetVariable Current 0][!WriteKeyValue Variables Current 0][!UpdateMeter *][!Redraw]
DynamicVariables=1

//////////// MINUS /////////////////

[BoxMinus]
Meter=Image
ImageName=#@#Minus.png
Y=5
X=159
LeftMouseUpAction=[!UpdateMeasure MeasureMinus]
DynamicVariables=1

///////////// PLUS ////////////////////

[BoxPlus]
Meter=Image
ImageName=#@#Plus1.png
Y=5
X=181
LeftMouseUpAction=[!UpdateMeasure MeasurePlus]
DynamicVariables=1

User avatar
eclectic-tech
Rainmeter Sage
Posts: 5382
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Increase bar clicking on button image?

Post by eclectic-tech »

GioRgSaVv wrote:But I ran into another problem, IfConditions don't work. Bar goes over than 100 and less than 0, I don't know how to fix it :/ Once again I need your help to fix it
Does this sound familiar: Use Clamp :17flag
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Increase bar clicking on button image?

Post by balala »

GioRgSaVv wrote:But I ran into another problem, IfConditions don't work. Bar goes over than 100 and less than 0, I don't know how to fix it :/ Once again I need your help to fix it :confused:
As eclectic-tech suggested:
eclectic-tech wrote:Does this sound familiar: Use Clamp
So, use the Clamp function into the !SetVariable and !WriteKeyValue bangs of the LeftMouseUpAction options of the [BoxMinus] and [BoxPlus] meters:

Code: Select all

[BoxMinus]
...
LeftMouseUpAction=[!SetVariable Current "(Clamp((#Current#-20),0,100))"][!WriteKeyValue Variables Current "(Clamp((#Current#-20),0,100))"][!UpdateMeter *][!Redraw]
DynamicVariables=1

[BoxPlus]
...
LeftMouseUpAction=[!SetVariable Current "(Clamp((#Current#+20),0,100))"][!WriteKeyValue Variables Current "(Clamp((#Current#+20),0,100))"][!UpdateMeter *][!Redraw]
DynamicVariables=1
User avatar
GioRgSaVv
Posts: 62
Joined: February 7th, 2017, 10:02 pm

Re: Increase bar clicking on button image?

Post by GioRgSaVv »

Thanks a lot guys, I really appreciate it :)
You helped me a lot!

So it is now complete, all that's left is to edit its appearance a little bit and make it more official, add the animated image when hit 100% and then share it here and on deviantart! :)

(Accidentally tho, I managed to do it, I messed up with the ifconditions a little bit and succeeded xD )
(this is how I did it)

Code: Select all

IfCondition=(#Current# >= 0)
IfFalseAction=[!SetVariable Current 0][!WriteKeyValue Variables Current 0][!UpdateMeter *][!Redraw]
IfCondition2=(#Current# <= 100)
IfFalseAction2=[!SetVariable Current 100][!WriteKeyValue Variables Current 100][!UpdateMeter *][!Redraw]
But in the end I used the clamp faction as it's a lot smaller than the ifconditions that I added above.
I just didn't know how to use clamp factions, in which position should I add them, what should I type afterwards :P

If balala wouldn't post this...

Code: Select all

[BoxMinus]
...
LeftMouseUpAction=[!SetVariable Current "(Clamp((#Current#-20),0,100))"][!WriteKeyValue Variables Current "(Clamp((#Current#-20),0,100))"][!UpdateMeter *][!Redraw]
DynamicVariables=1

[BoxPlus]
...
LeftMouseUpAction=[!SetVariable Current "(Clamp((#Current#+20),0,100))"][!WriteKeyValue Variables Current "(Clamp((#Current#+20),0,100))"][!UpdateMeter *][!Redraw]
DynamicVariables=1
...I think I would have ended up using the ifconditions xD

Once again, thank you! :bow:
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Increase bar clicking on button image?

Post by balala »

GioRgSaVv wrote:If balala wouldn't post this...
There is always something new to learn. But don't forget, eclectic-tech suggested first to use the Calmp function.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Increase bar clicking on button image?

Post by balala »

And one more small comment: Update=16? Why? Doesn't worth. If this will be the whole code of your skin (so if you don't want to add further parts to the code) in case of such mouse commanded skins, Update=-1 is a perfectly good option. Update=-1 means that the skin is never updated (excepting the very first moment, when it is refreshed / loaded), but you don't even have to.
But even if you decide to not use the update set to -1, at least use the default Update=1000. As I said, doesn't worth to update the skin very often, because this uselessly loads the CPU.