It is currently March 28th, 2024, 7:44 pm

Reverse relative position

Get help with creating, editing & fixing problems with skins
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Reverse relative position

Post by Active Colors »

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).

My base images looks like this:

Code: Select all

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

[Meter2]
Meter=Image
X=r
Y=10R
W=100
H=45

[Meter3]
Meter=Image
X=r
W=10R
H=100
H=

And for each base meter there are text meters, and to differentiate them they are called like this:

Code: Select all

[Meter1Text1]
Meter=String
MeterStyle=MeterText

[Meter1Text2]
Meter=String
MeterStyle=MeterText

[Meter2Text1]
Meter=String
MeterStyle=MeterText

[Meter3Text1]
Meter=String
MeterStyle=MeterText

[Meter3Text2]
Meter=String
MeterStyle=MeterText

[Meter3Text3]
Meter=String
MeterStyle=MeterText
I want to use same MeterStyle for all string meters in a way that they all take Y of MeterN. In other words I want [MeterNText1:Y] to be placed relatively to corresponding Y 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.
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Reverse relative position

Post by Active Colors »

Same thing but with visual representation. I have three base blocks. They are called [Meter1], [Meter2], [Meter 3]:
Capture2.PNG

Now I need to put string Meters [MeterNText1] relatively to the corresponding N of a [MeterN]:
Capture.PNG
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: Reverse relative position

Post by balala »

Wouldn't be much easier to create three different styles and use the appropriate one for each "group"? Something like this:

Code: Select all

[Meter1Style]
X=[Meter1:X]
DynamicVariables=1

[Meter2Style]
X=[Meter2:X]
DynamicVariables=1

[Meter3Style]
X=[Meter3:X]
DynamicVariables=1

[Meter1Text1]
Meter=String
MeterStyle=Meter1Style

[Meter1Text2]
Meter=String
MeterStyle=Meter1Style

[Meter1Text3]
Meter=String
MeterStyle=Meter1Style

[Meter2Text1]
Meter=String
MeterStyle=Meter2Style

[Meter2Text2]
Meter=String
MeterStyle=Meter2Style

[Meter2Text3]
Meter=String
MeterStyle=Meter2Style

[Meter3Text1]
Meter=String
MeterStyle=Meter3Style

[Meter3Text2]
Meter=String
MeterStyle=Meter3Style

[Meter3Text3]
Meter=String
MeterStyle=Meter3Style
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Reverse relative position

Post by Active Colors »

balala wrote:Wouldn't be much easier to create three different styles and use the appropriate one for each "group"? Something like this:

Code: Select all

[Meter1Style]
X=[Meter1:X]
DynamicVariables=1

[Meter2Style]
X=[Meter2:X]
DynamicVariables=1

[Meter3Style]
X=[Meter3:X]
DynamicVariables=1

[Meter1Text1]
Meter=String
MeterStyle=Meter1Style

[Meter1Text2]
Meter=String
MeterStyle=Meter1Style

[Meter1Text3]
Meter=String
MeterStyle=Meter1Style

[Meter2Text1]
Meter=String
MeterStyle=Meter2Style

[Meter2Text2]
Meter=String
MeterStyle=Meter2Style

[Meter2Text3]
Meter=String
MeterStyle=Meter2Style

[Meter3Text1]
Meter=String
MeterStyle=Meter3Style

[Meter3Text2]
Meter=String
MeterStyle=Meter3Style

[Meter3Text3]
Meter=String
MeterStyle=Meter3Style
Not really, because I have many such meters, it might be 10, 20, or 50, or even more.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Reverse relative position

Post by fonpaolo »

Active Colors wrote:Not really, because I have many such meters, it might be 10, 20, or 50, or even more.
...while, in a similar situation, I always copy and paste one section to the next, modifying only something here and there*.
...call me crazy. O.O

*I did it 120 times in one skin...
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Reverse relative position

Post by Active Colors »

fonpaolo wrote:...while, in a similar situation, I always copy and paste one section to the next, modifying only something here and there*.
...call me crazy. O.O

*I did it 120 times in one skin...
Exactly why I want to achieve this with just one MeterStyle so I don't change it here and there. Just to have one single place to do such a simple task.
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Reverse relative position

Post by FreeRaider »

Honestly, I do not understand what you want, so can you post a real sample code, please?
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Reverse relative position

Post by balala »

Active Colors wrote:Exactly why I want to achieve this with just one MeterStyle so I don't change it here and there. Just to have one single place to do such a simple task.
Yes, but take into account that Rainmeter isn't a programming language and you probably won't be able to do something like what you want in Rainmeter. Probably fonpaolo is right and you have to make a few (or much more?) copy, paste and modification operations.
Me at least don't see any way to make what you want through Rainmeter code.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Reverse relative position

Post by fonpaolo »

Probably it's what you do, I try to standardize the code using relative positioning of all the meters of the section to the first, then I copy and paste to a new section and I only modify the names of the meters (MeterX_1, 2, A, B and so on)and maybe the group name if/when needed.
I don't think I've reinvented the wheel...
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: Reverse relative position

Post by Mor3bane »

Isnt there a way that a LUA script would help?

Seems that is the whole purpose - coding repetitive functions in fewer lines of code?

Ya'know... a function creates b function c = b, b is the new line of code, c becomes a, then a tells b what to be. rinse and repeat in an if then or even a for loop, maybe a do while?
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.