It is currently March 28th, 2024, 2:53 pm

Reverse relative position

Get help with creating, editing & fixing problems with skins
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5382
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: Reverse relative position

Post by eclectic-tech »

Active Colors wrote:Hello.
I want to use a method of reverse relative position.

I have an image meter which serves as a base object for other meters like String meters. Because I have many such base objects which have many string meters it is quite repetitious and I don't want to use every time same formulas with a small change for all the string meters. Let's take a look at my example (I can change in any way you recommend saving the concept).

I want to use same MeterStyle for all string meters in a way that they all take X of MeterN. In other words I want [MeterNText1:X] to be placed relatively to corresponding X of [MeterN] of the same N. How to approach this?

P.s. I am not quite sure if it is called reverse relative position but it looks like that for me.
As already mentioned, I don't think there is a "One-Size-Fits-All" answer. :confused:

But rather than creating separate styles, you can use the background image meter itself as the style and make the associated string meters relative to that meter. :sly:

You already have to create the image meter for the background, so using it as the style eliminates the need for a separate style, however, because it includes all options for the image meter, you will need to modify the included options in the string meter when using (or not using) those values.

So in the end, I am not sure if this will simplify creating multiple backgrounds with relative text. :uhuh:

Here is a demo similar to your example using the image meters as the style with relative text. When you change the image meter positions, the relative text will follow, but you will see some additional code needs to be added to the string meters to remove undesirable options from the style and to position extra lines of text.

Code: Select all

[Meter1]
Meter=Image
X=10
Y=10
W=100
H=60
SolidColor=255,255,255,100

[Meter2]
Meter=Image
X=r
Y=80
W=100
H=60
SolidColor=255,255,255,100

[Meter3]
Meter=Image
X=r
Y=150
W=100
H=60
SolidColor=255,255,255,100

[Meter1Text1]
Meter=String
MeterStyle=Meter1
Text=Meter1Text1
SolidColor=0,0,0,1

[Meter1Text2]
Meter=String
MeterStyle=Meter1
X=r
Y=14r
Text=Meter1Text2
SolidColor=0,0,0,1

[Meter1Text3]
Meter=String
MeterStyle=Meter1
X=r
Y=14r
Text=Meter1Text3
SolidColor=0,0,0,1

[Meter2Text1]
Meter=String
MeterStyle=Meter2
Text=Meter2Text1
SolidColor=0,0,0,1

[Meter2Text2]
Meter=String
MeterStyle=Meter2
X=r
Y=14r
Text=Meter2Text2
SolidColor=0,0,0,1

[Meter2Text3]
Meter=String
MeterStyle=Meter2
X=r
Y=14r
Text=Meter2Text3
SolidColor=0,0,0,1

[Meter3Text1]
Meter=String
MeterStyle=Meter3
Text=Meter3Text1
SolidColor=0,0,0,1

[Meter3Text2]
Meter=String
MeterStyle=Meter3
X=r
Y=14r
Text=Meter3Text2
SolidColor=0,0,0,1

[Meter3Text3]
Meter=String
MeterStyle=Meter3
X=r
Y=14r
Text=Meter3Text3
SolidColor=0,0,0,1
relativetext.png
Now move the second background right and the third background relatively back to the first.
relativetext2.png
I may have the same understanding as FreeRaider experienced :D , so this may not help at all :oops:
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Reverse relative position

Post by ikarus1969 »

I would take a one-liner of lua and do the following:

create a lua script with the following content (or integrate it in some existing one):

Code: Select all

function getMeterNumber(parm_str)

  return string.match(parm_str, '^%D+(%d-)%D.+$');

end
then code the x-position of the "MeterN1TextN2"-meters as in this code. This works for me:

Code: Select all

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


[MeasureScript]
Measure=Script
ScriptFile=MyScript.lua
Disabled=1

[MeterText]
Text=#CURRENTSECTION#
AntiAlias=1
DynamicVariables=1
FontColor=FFFFFFFF
SolidColor=000000FF

[Meter1]
Meter=Image
X=10
Y=10
W=100
H=60
SolidColor=004080FF

[Meter2]
Meter=Image
X=20R
Y=10R
W=100
H=45
SolidColor=FF0000FF

[Meter3]
Meter=Image
X=40R
W=10R
H=100
SolidColor=FFFF00FF

; [Measure_Time]
; Measure=TIME
; Format="%S"

[Meter1Text1]
Meter=String
MeterStyle=MeterText
X=[&Meter[&MeasureScript:getMeterNumber('#CURRENTSECTION#')"]:X]

[Meter1Text2]
Meter=String
MeterStyle=MeterText
X=[&Meter[&MeasureScript:getMeterNumber('#CURRENTSECTION#')"]:X]

[Meter2Text1]
Meter=String
MeterStyle=MeterText
X=[&Meter[&MeasureScript:getMeterNumber('#CURRENTSECTION#')"]:X]

[Meter3Text1]
Meter=String
MeterStyle=MeterText
X=[&Meter[&MeasureScript:getMeterNumber('#CURRENTSECTION#')"]:X]

[Meter3Text2]
Meter=String
MeterStyle=MeterText
X=[&Meter[&MeasureScript:getMeterNumber('#CURRENTSECTION#')"]:X]

[Meter3Text3]
Meter=String
MeterStyle=MeterText
X=[&Meter[&MeasureScript:getMeterNumber('#CURRENTSECTION#')"]:X]
Screenshot MeterPositioning.png
Post Reply