It is currently May 2nd, 2024, 11:52 pm

Interlocking Relative Values Between Meters

Report bugs with the Rainmeter application and suggest features.
User avatar
UnstoppableDave
Posts: 30
Joined: May 22nd, 2010, 6:51 pm

Interlocking Relative Values Between Meters

Post by UnstoppableDave »

Hey guys,
Do we currently have the option to use the name of another meter in the X or Y of a meter? I think this would be really useful as it would remove the limitation on only being able to relatively position the current meter based on the meter above it. W and H would also be nice but not critical. I'm working on a skin now that has two meters for each item, one that shows depending on time of day, so it would be very useful to me (and i'm sure for many other situations) to have interlocking relative values such as this.

So something like...
Y=[SomeMeter]R
Would mean directly below SomeMeter.

And we'd really also need then
Y=[SomeMeter]5R
For 5 px below etc.

and maybe even (would be super awesome)
Y=[SomeMeter]#Variable#R

What do you guys think? Is this even possible with the method that rainmeter draws meters?

-Dave
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: Interlocking Relative Values Between Meters

Post by JpsCrazy »

You can do something like:
Y=[someMeasure]
X=[AnotherMeasure]R

For more pixels,
Y=([someMeasure]+5)R

And substituting 5 for a variable would be possible.


You have to use DynamicVariables for using measures as values like this.
User avatar
UnstoppableDave
Posts: 30
Joined: May 22nd, 2010, 6:51 pm

Re: Interlocking Relative Values Between Meters

Post by UnstoppableDave »

ok... how would using measures be used to position meters without an insanely confusing network of variables and measures for the positions of the meters?
Image
User avatar
JpsCrazy
Posts: 667
Joined: April 18th, 2010, 2:16 pm
Location: NY, USA

Re: Interlocking Relative Values Between Meters

Post by JpsCrazy »

I can't think of a good theoretical example - so here's a real one.

http://jpscrazy.deviantart.com/#/d2rgnrj

A volume slider I made.
The circle's position is based on a measure.

An explanation:

Code: Select all

[Variables]
	StartValue=165
	Vol=15
	Clicks=15

[msClicks]
	Measure=Calc
	Formula=ROUND(135/#Clicks#)
	DynamicVariables=1

[msCirclePlace]
	Measure=Calc
	Formula=((#StartValue#+((-#Vol#)*[msClicks])>31)) ? (#StartValue#+((-#Vol#)*[msClicks])) : 31
	DynamicVariables=1

[mtCircle]
	Meter=Image
	ImageName="#SkinsPath#\Volume Slider\Resources\Circle.png"
	X=5
	Y=[msCirclePlace]
	W=10
	H=10
	DynamicVariables=1
The start value is just where the volume 0 would be. It happens to be 165. Vol is the current volume. msClicks is how much the circle moves by with each increase in volume.
So, the start value - current volume * the amount of space for the clicks is where the circle is. 31 is the minimum, so the condition stops it there. (If it's greater than 31 it's whatever it is, if it's supposed to be less it's just 31.)
That translates to 165-15*9.
Now, 15 can change, so the ball can change. It could be 165-10*9 or 165-5*9.
Hopefully you kind of get it.
User avatar
UnstoppableDave
Posts: 30
Joined: May 22nd, 2010, 6:51 pm

Re: Interlocking Relative Values Between Meters

Post by UnstoppableDave »

Um... ok, sorry I still don't see how that helps with general meter positioning.
Image
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Interlocking Relative Values Between Meters

Post by jsmorley »

UnstoppableDave wrote:Um... ok, sorry I still don't see how that helps with general meter positioning.
No, you cannot use the name of a meter in the X or Y (or anything else really) of another meter. Relative positioning works ("r" or "R") but it is relative to the immediately previous meter. Anything is possible, but I can't see this being a terribly high priority.

If you use "R" for the relative positioning, it will in fact ignore (mostly) the immediately previous meter if that meter is "hidden" and will move up/over as needed to become relative to the one above that. This can solve (mostly) issues, like yours, where you are trying to deal with meters that come and go based on the value of a measure or a mouse click.

Click the top box to demonstrate what I mean.

[Rainmeter]
Update=500
DynamicWindowSize=1

[Meter1]
Meter=Image
SolidColor=255,0,0,255
X=0
Y=0
W=60
H=60
LeftMouseUpAction=!RainmeterToggleMeter Meter2

[Meter2]
Meter=Image
X=0
Y=3R
SolidColor=0,255,0,255
W=60
H=60

[Meter3]
Meter=Image
X=0
Y=3R
SolidColor=0,0,255,255
W=60
H=60

P.S. When I said "mostly" above, I was referring to the fact that although the blue (bottom) box will move up in this example, it will in fact be 6 pixels "relative" to the red (top) box instead of 3, as while the meter itself in effect now has a W and H of zero and is ignored, both of the "Y=3R" statements are seen and you end up with 6 pixles between red and blue. For this to be perfect, you are probably going to want to set things up with some border spacing in such a way that you can use Y=R (the same as Y=0R), which should eliminate this problem.