It is currently April 25th, 2024, 8:50 pm

Help with sliders

Get help with creating, editing & fixing problems with skins
User avatar
Alloutofmercy
Posts: 142
Joined: November 17th, 2021, 5:51 am

Help with sliders

Post by Alloutofmercy »

Can anyone tell me what I am doing wrong (Again)
I was following this Actiontimer article https://forum.rainmeter.net/viewtopic.php?t=23269
(Not the one by jsmorley, but the one by Danielpodo)
I am not able to comprehend the use of Setvariable. It is difficult to understand what excactly it does
All I want is the sidebar to minimize into a thin line and when clicked on again transforms into a sidebar.

Edit. Sorry here is my code

Code: Select all

[MeterMainbar]
Meter=image
X=#XPos#
Y=1
W=40
h=1080
StrokeWidth 0 | Stroke Color 0,120,255
SolidColor=#Accent01#
UpdateDivider=-1
DynamicVariables=1
Group=Sliders
LeftMouseUpAction=[!CommandMeasure DeceleratingSlider "Execute #State#"]


[DeceleratingSlider]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat SlideLeft, 30, 25
SlideLeft=[!SetVariable State "2"][!SetVariable Velocity "(Clamp((#Velocity#+1),0,20))"][!SetVariable XPos "(Trunc((#Amount#-#Amount#*(1-1/(2048**(0.05*#Velocity#))))))"]#Update#
ActionList2=Repeat SlideRight, 30, 25
SlideRight=[!SetVariable State "1"][!SetVariable Velocity "(Clamp((#Velocity#-1),0,20))"][!SetVariable XPos "(Trunc((#Amount#-#Amount#*(1-1/(2048**(0.05*#Velocity#))))))"]#Update#
DynamicVariables=1

Code: Select all

[Variables]
Velocity=0
Amount=200
XPos=200
State=1
Update=[!UpdateMeasure DeceleratingSlider][!UpdateMeter *][!Redraw]
Bgcolor=50,100,330,0
Flash=255, 204, 214,250
@include=#@#\Variables.inc
OffSet=-190
BOOTY
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with sliders

Post by balala »

Alloutofmercy wrote: December 22nd, 2021, 2:45 pm I am not able to comprehend the use of Setvariable. It is difficult to understand what excactly it does
It does exactly what its name says: sets new value for a variable. For instance in your case the [!SetVariable State "2"] bang, used into the SlideLeft option of the [DeceleratingSlider] ActionTimer plugin measure, sets the value 2 for the State variable, when ActionList1 get executed.
One extremely important thing you have to keep in mind is that you have to add a DynamicVariables=1 option to any measure or meter in which you want to use the variable. For example you've added this option to the [MeterMainbar] meter of your code, among other thing because the #State# variable is used into the LeftMouseUpAction option of this meter. And one more detail: the [Rainmeter] section is not dynamic (DynamicVariables=1 makes no sense there) and this is one reason why you can't use dynamically set variable in this section.
Is there anything other you can't understand?
Alloutofmercy wrote: December 22nd, 2021, 2:45 pm All I want is the sidebar to minimize into a thin line and when clicked on again transforms into a sidebar.
More small details needed in order to het it working as expected. Unless I misunderstood something, here is one scenario of what you should do:
  • Add a SkinWidth=240 option to the [Rainmeter] section of your skin.
  • Widen a little bit the [MeterMainbar] meter, by replacing its W=40 option with W=240.
That's all, I think. If you want something else (so if I misunderstood something), please let me know, to cen fix.
Alloutofmercy wrote: December 22nd, 2021, 2:45 pm (Not the one by jsmorley, but the one by Danielpodo)
To can precisely indicate which post are you referring to, click the title of the post and paste back here in the forum what you get as the URL in the address bar of your browser. For instance if you click the Re: Sliding a Skin with ActionTimer title of DanielPodo's post in the mentioned topic, you get the following URL in the address bar: https://forum.rainmeter.net/viewtopic.php?t=23269#p123515 This is what you have to post to indicate precisely the post you want to refer to.
User avatar
Alloutofmercy
Posts: 142
Joined: November 17th, 2021, 5:51 am

Re: Help with sliders

Post by Alloutofmercy »

Code: Select all

[Rainmeter]
Update=1000
SkinWidth=500
AccurateText=1
DynamicVariables=1
SkinWidth=240

[Variables]
Velocity=0
Amount=200
XPos=200
State=1
Update=[!UpdateMeasure DeceleratingSlider][!UpdateMeter *][!Redraw]
Bgcolor=50,100,330,0
Flash=255, 204, 214,250
@include=#@#\Variables.inc
OffSet=-190

[MeterMainbar]
Meter=image
X=0-#XPos#
Y=1
W=240
h=1080
StrokeWidth 0 | Stroke Color 0,120,255
SolidColor=#Accent01#
UpdateDivider=-1
DynamicVariables=1
Group=Sliders
LeftMouseUpAction=[!CommandMeasure DeceleratingSlider "Execute #State#"]


[DeceleratingSlider]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat SlideLeft, 30, 25[Shadow][/Shadow]
SlideLeft=[!SetVariable State "2"][!SetVariable Velocity "(Clamp((#Velocity#+1),0,20))"][!SetVariable XPos "(Trunc((#Amount#-#Amount#*(1-1/(2048**(0.05*#Velocity#))))))"]#Update#
ActionList2=Repeat SlideRight, 30, 25
SlideRight=[!SetVariable State "1"][!SetVariable Velocity "(Clamp((#Velocity#-1),0,20))"][!SetVariable XPos "(Trunc((#Amount#-#Amount#*(1-1/(2048**(0.05*#Velocity#))))))"]#Update#
DynamicVariables=1

here is the overall code. dynamic vars is onn on all meters, width is 240, got a big rectangle. It is clickable but nothing happens on click.
BOOTY
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Help with sliders

Post by eclectic-tech »

Formulas outside of Calc measures need to be enclosed in parentheses. You did not do that in the X value of [MeterMainbar].
Change it to: X=(0-#XPos#)

You also have

Code: Select all

[shadow][/shadow]
at the end of ActionList1 in your posted code; I deleted that text.

With those changes, the bar expands and recedes for me with the mouse action.
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with sliders

Post by balala »

eclectic-tech wrote: December 23rd, 2021, 5:54 pm Formulas outside of Calc measures need to be enclosed in parentheses.
Two details, just to be precise:
  • Reformulating the above sentence: "Formulas outside of Formula option of Calc measures need to be enclosed in parentheses." - Important that formulas used into any other option than Formula of any type of measures (including even the other options of a Calc measure as well) have to be the same way included into parentheses. With one more exception (below).
  • Another option which doesn't require the parentheses in formulas is IfCondition. For instance IfCondition=#MyVariable#+10>100 works the same way as IfCondition=(#MyVariable#+10>100) or IfCondition=((#MyVariable#+10)>100). It's a completely other question that it looks far better using the parentheses (and me personally don't even see, at least not easily, what is in the IfCondition option, if the parentheses are omitted), but strictly speaking, the option works both ways: with and without the parentheses.
Sorry eclectic-tech, don't want to upset you, hope you don't mind, but I think this had to be said.
User avatar
Alloutofmercy
Posts: 142
Joined: November 17th, 2021, 5:51 am

Re: Help with sliders

Post by Alloutofmercy »

Code: Select all

[Variables]
Velocity=0
Amount=200
XPos=200
State=1
Update=[!UpdateMeasure DeceleratingSlider][!UpdateMeter *][!Redraw]
Bgcolor=50,100,330,0
Flash=255, 204, 214,250
@include=#@#\Variables.inc
OffSet=-190

Code: Select all

[MeterMainbar]
Meter=image
X=#XPos#
Y=1
W=240
h=1080
StrokeWidth 0 | Stroke Color 0,120,255
SolidColor=#Accent01#
DynamicVariables=1
Group=Sliders
LeftMouseUpAction=[!CommandMeasure DeceleratingSlider "Execute #State#"]


[DeceleratingSlider]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat SlideLeft, 30, 25
SlideLeft=[!SetVariable State "2"][!SetVariable Velocity "(Clamp((#Velocity#+1),0,20))"][!SetVariable XPos "(Trunc((#Amount#-#Amount#*(1-1/(2048**(0.05*#Velocity#))))))"]#Update#
ActionList2=Repeat SlideRight, 30, 25
SlideRight=[!SetVariable State "1"][!SetVariable Velocity "(Clamp((#Velocity#-1),0,20))"][!SetVariable XPos "(Trunc((#Amount#-#Amount#*(1-1/(2048**(0.05*#Velocity#))))))"]#Update#
DynamicVariables=1


Nope. Still dosent work. I think there is something wrong with the measure.
BOOTY
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Help with sliders

Post by eclectic-tech »

You completely removed the formula?
You changed X=(0-#XPos#) to X=#XPos# which is why it doesn't change.
Change it back to:

Code: Select all

[MeterMainbar]
Meter=image
X=(0-#XPos#)
Y=1
W=240
h=1080
StrokeWidth 0 | Stroke Color 0,120,255
SolidColor=#Accent01#
UpdateDivider=-1
DynamicVariables=1
Group=Sliders
LeftMouseUpAction=[!CommandMeasure DeceleratingSlider "Execute #State#"]
@balala I always appreciate you clarifying procedures. I tend to oversimplify responses. :rosegift:
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with sliders

Post by balala »

eclectic-tech wrote: December 24th, 2021, 12:53 pm You completely removed the formula?
You changed X=(0-#XPos#) to X=#XPos# which is why it doesn't change.
Change it back to:

Code: Select all

[MeterMainbar]
Meter=image
X=(0-#XPos#)
Y=1
W=240
h=1080
StrokeWidth 0 | Stroke Color 0,120,255
SolidColor=#Accent01#
UpdateDivider=-1
DynamicVariables=1
Group=Sliders
LeftMouseUpAction=[!CommandMeasure DeceleratingSlider "Execute #State#"]
There is a weird think. X=(0-#XPos#) does perfectly works, however even X=-#XPos# does. with no parentheses, but the option does work. :confused:
eclectic-tech wrote: December 24th, 2021, 12:53 pm @balala I always appreciate you clarifying procedures. I tend to oversimplify responses. :rosegift:
User avatar
Alloutofmercy
Posts: 142
Joined: November 17th, 2021, 5:51 am

Re: Help with sliders

Post by Alloutofmercy »

Code: Select all

[Rainmeter]
Update=25
SkinWidth=500
AccurateText=1
DynamicVariables=1
SkinWidth=240


[Variables]
Velocity=0
Amount=200
XPos=200
State=1
Update=[!UpdateMeasure DeceleratingSlider][!UpdateMeter *][!Redraw]
Bgcolor=50,100,330,0
Flash=255, 204, 214,250
@include=#@#\Variables.inc
OffSet=-190
@INCLUDE=Style.ini
TextFont=Clear Sans
TextStyle=Bold
MainSize=11
SmallSize=9
FadeTime=500
@Include20=Fade.lua
[MeasureGlow]
Measure=Calc
Formula=(ROUND(((([MeasureGlowPre])-30)/30)*200))
DynamicVariables=1
Substitute="-":""

[MainBackground]
DynamicVariables=1
SolidColor=[DesktopBG1]FF







XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

[MeterMainbar]
Meter=image
X=-#XPos#
Y=1
W=240
h=1080
StrokeWidth 0 | Stroke Color 0,120,255
SolidColor=#Accent01#
UpdateDivider=-1
DynamicVariables=1
Group=Sliders
LeftMouseUpAction=[!CommandMeasure DeceleratingSlider "Execute #State#"]


XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


[DeceleratingSlider]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat SlideLeft, 30, 25
SlideLeft=[!SetVariable State "2"][!SetVariable Velocity "(Clamp((#Velocity#+1),0,20))"][!SetVariable XPos "(Trunc((#Amount#-#Amount#*(1-1/(2048**(0.05*#Velocity#))))))"]#Update#
ActionList2=Repeat SlideRight, 30, 25
SlideRight=[!SetVariable State "1"][!SetVariable Velocity "(Clamp((#Velocity#-1),0,20))"][!SetVariable XPos "(Trunc((#Amount#-#Amount#*(1-1/(2048**(0.05*#Velocity#))))))"]#Update#
DynamicVariables=1











[TrayShape]
Meter=Shape
X=10
Y=12
Shape=Rectangle -9,-10,40,40, | StrokeWidth 0 | FillColor=0,29,100,60
Hidden=1
Antialias=1


[Menulove]
Meter=Image
ImageName=#@#\Images\angle-down.png
X=10
Y=10
W=20
MouseOverAction=[!ShowMeter "TrayShape"][!Redraw]
MouseLeaveAction=[!HideMeter "TrayShape"][!Redraw]
LeftMouseUpAction=!ToggleFade "Maximalist suite\SettingsMenu"



[Background]
Meter=Shape
W=128
H=22
DynamicVariables=1
SolidColor=255,255,255,1

[Meterbg]
meter=shape
X=10
Y=50
Shape=Rectangle -9,-10,40,40, | StrokeWidth 0 |FillColor=0,29,100,60
Antialias=1
Hidden=1



[Musicbuttonicon]
Meter=Image
ImageName=#@#\Images\icons8-music-96.png
LeftMouseUpAction=!ToggleFade "Maximalist suite\Music"
W=23
X=5
Y=48
MouseOverAction=[!ShowMeter "Meterbg"][!Redraw]
MouseLeaveAction=[!HideMeter "Meterbg"][!Redraw]


[Searchicon]
Meter=Image
ImageName=#@#\icons8-google-48.png
x=7
y=89
W=25
MouseOverAction=[!ShowMeter Hoverbg][!Redraw]
MouseLeaveAction=[!HideMeter Hoverbg][!Redraw]
LeftMouseUpAction=!ToggleFade "Maximalist suite\Searchbar"


[Hoverbg]
meter=shape
X=10
Y=88
Shape=Rectangle -9,-10,40,40, | StrokeWidth 0 |FillColor=0,29,100,60
Antialias=1
Hidden=1

[Wheathertoggle]
Meter=Image
Imagename=#@#\I
X=0
y=120
W=40
H=40




[ChameleonDesktop]
Measure=Plugin
Plugin=Chameleon
Type=Desktop

[ChamFG1]
Measure=Plugin
Plugin=Chameleon
Parent=ChameleonDesktop
Color=Foreground1

[ChamFG2]
Measure=Plugin
Plugin=Chameleon
Parent=ChameleonDesktop
Color=Foreground2

[ChamBG1]
Measure=Plugin
Plugin=Chameleon
Parent=ChameleonDesktop
Color=Background1

[ChamBG2]
Measure=Plugin
Plugin=Chameleon
Parent=ChameleonDesktop
Color=Background2

[DesktopBG1]
Measure=Script
ScriptFile=#@#Fade.lua
Source=ChamBG1
Timestep=25

[DesktopBG2]
Measure=Script
ScriptFile=#@#Fade.lua
Source=ChamBG2
Timestep=25

[DesktopFG1]
Measure=Script
ScriptFile=#@#Fade.lua
Source=ChamFG1
Timestep=25

[DesktopFG2]
Measure=Script
ScriptFile=#@#Fade.lua
Source=ChamFG2
Timestep=25

[MainTextStyle]
DynamicVariables=1
FontFace=#TextFont#
FontSize=#MainSize#
FontColor=[DesktopFG1]FF
StringStyle=#TextStyle#
AntiAlias=1

[SmallTextStyle]
DynamicVariables=1
FontFace=#TextFont#
FontColor=[DesktopFG2]FF
FontSize=#SmallSize#
StringStyle=#TextStyle#
AntiAlias=1

[MainImageStyle]
DynamicVariables=1
Greyscale=1
ImageTint=[DesktopFG1]FF

[MainBarStyle]
DynamicVariables=1
BarColor=[DesktopFG2]FF
BarOrientation=HORIZONTAL

[MainBackground]
DynamicVariables=1
SolidColor=[DesktopBG1]FF

[MainBarBackground]
DynamicVariables=1
ImageName=#@#BarBG.png
Greyscale=1
ImageTint=[DesktopBG2]FF
Strangely it dosent work for me. I've tried debugging my entire code several times, but I dint know what is going wrong
Screenshot (15).png
You do not have the required permissions to view the files attached to this post.
BOOTY
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help with sliders

Post by balala »

Alloutofmercy wrote: December 25th, 2021, 7:03 pm Strangely it dosent work for me. I've tried debugging my entire code several times, but I dint know what is going wrongScreenshot (15).png
Does perfectly works. It's true i can't follow everything, the code has a lot of thing which I can't get showing, having many - many resources involved (images, like @Resources\Images\angle-down.png, @Resources\Images\icons8-music-96.png and dozens of others, as well as included files: Variables.inc, Style.ini or Fade.lua and who knows what else), however the sliding right and left when clicking, does perfectly works (as said above). So am not sure what doesn't for you. Maybe would be useful to pack the whole config you have and upload the package here, to can check it in the same way as you have it.

Additional notes:
  • Doesn't make too much sense to include a .lua file as an included file. You did this with the @Include20=Fade.lua option of the [Variables] section, but as said, this makes no sense. You've used this file in five (???!) Script measures ([ChamBG2], [DesktopBG1], [DesktopBG2] ,[DesktopFG1] and [DesktopFG2]) and using it this way is alright (question is if it's needed to have five such measures, but maybe it is - but not having the Fade.lua file, can't say precisely), however it's not needed to include the same Fade.lua file as an included file in the [Variables] section (in short, remove the @Include20=Fade.lua option of the [Variables] section, especially that the path is not correct either - the @Resources folder is missing).
  • The #@# variable contains a backslash by itself, no need to add one more. For instance in the @include=#@#\Variables.inc option of the [Variables] section, the backslash (red above) is not needed (PS here). But even if you add it (or even if you add more) it's not a problem, Rainmeter simply ignores them. But strictly speaking, it is not needed.
  • In Rainmeter (or in fact in any .ini file) you can't use more times a section name. Each section has to have a unique name, same way as each variables has to have a unique name. And neither options can be duplicated into one section. What am I talking about is that for instance there are two sections named [MainBackground]. Rainmeter ignores the second section. Additionally none of these sections is not valid, both having only a DynamicVariables and a SolidColor option. Didn't tell for instance which kind of meters are these. And didn't used them as style section into other meters, at least not in the posted code (maybe in one of the included files?).
So if you want, I'm waiting for the package, to can check it and see what's not going on well.