It is currently April 23rd, 2024, 4:41 pm

Calculating next meter number

Get help with creating, editing & fixing problems with skins
User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Calculating next meter number

Post by StArL0rd84 »

Lets say i have a meter called [Background11], is there a way to calculate the name [Background12] from that?
I remember seeing something evolving a modulus sign a while back, but where escapes me.

Maybe something like this:
[!SetOption "Background%+1" "SomeOption" "SomeValue"]

Or: #CURRENTSECTION#%+1

Of cause my syntax don't make any real sense, but it's just to convey what i mean.
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Calculating next meter number

Post by FreeRaider »

User avatar
StArL0rd84
Posts: 424
Joined: February 8th, 2015, 10:07 pm
Location: EU, Denmark.

Re: Calculating next meter number

Post by StArL0rd84 »

I'm familiar with nesting variables.
How can that give me the number for the next meter? (12)
([mWorkTime] = 1 ? #Work# : ([mEnergyLoss:%] >= 70% ? #Chillmode# : </>))
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Calculating next meter number

Post by eclectic-tech »

StArL0rd84 wrote: June 8th, 2019, 7:48 pm I'm familiar with nesting variables.
How can that give me the number for the next meter? (12)
Outside of using a Lua script to determine a sequence of meters, you could use the scheme here, or a variable that you control via a bang or a measure.

In order to use #CurrentSection# in a formula, it has to be able to be resolved to a numerical value, so you cannot have section names with alphabetical characters (strictly numbers). But instead of "Background1", "Background2", etc. you could give your meters number names; [1.01], [1.02], [1.03], etc.

This would give you up to 100 possible meters in group 1; you could create multiple numbered groups, e.g.; [2.01], [2.02], etc. and use the section names in formulas to determine which meter is the target of your action bang.

A meter can not perform any calculations other than in action bangs that use use formulas.
Only measures can calculate and take actions based on any type of IfCondition or IfMatch logic.

With more details, someone may be able to give a better option :welcome:
User avatar
Cariboudjan
Posts: 268
Joined: May 12th, 2019, 8:55 am

Re: Calculating next meter number

Post by Cariboudjan »

I've thought about this. I've used section names [1] [2] [3] [4] [5] etc. and then used #CURRENTSECTION# to get the number, but this can only be used once per config. If you need to use it more than once you're out of luck. Using this method can be a HUGE time saver, but being able to somehow use this method in more than 1 group of sections would be incredible.

I would be great if you could store a number or string inside of a meter. For example

[Meter]
Meter=Image
Stored1=123
Stored2=ABC
Stored3=!!!

And then being able to call those at any time using

Code: Select all

[Meter:Stored1] [Meter:Stored2] [Meter:Stored3]
Output: 123 ABC !!!
Last edited by Cariboudjan on June 9th, 2019, 12:01 am, edited 5 times in total.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Calculating next meter number

Post by eclectic-tech »

Cariboudjan wrote: June 8th, 2019, 11:56 pm I've thought about this. I've used section names [1] [2] [3] [4] [5] etc. and then used #CURRENTSECTION# to get the number, but this can only be used once per config. If you need to use it more than once you're out of luck. Using this method can be a HUGE time saver, but being able to somehow use this method in more than 1 group of sections would be incredible.
That is what I explained; each number group can have 100 different submeters (1.00 to 1.99) that can be referenced using formulas
Cariboudjan wrote: June 8th, 2019, 11:56 pmI would be great if you could store a number or string inside of a meter. For example

[Meter]
Meter=Image
Stored1=123
Stored2=ABC
Stored3=!!!

And then being able to call those at any time using

Code: Select all

[Meter:Stored1] [Meter:Stored2] [Meter:Stored3]
Output: 123 ABC !!!
This is handled by using Variables
User avatar
Cariboudjan
Posts: 268
Joined: May 12th, 2019, 8:55 am

Re: Calculating next meter number

Post by Cariboudjan »

I don't think you understand.

The reason for storing a value inside of a meter is for time saving when using Styles.

For example, currently you can do this to save time: Notice how the [SectionName] used in !SetOption uses Icon#CURRENTSECTION#.

Code: Select all

[Rainmeter]

[Variables]

[StringStyle]
SolidColor=0,255,0
MouseOverAction=[!SetOption Icon#CURRENTSECTION# SolidColor 255,255,255][!UpdateMeter Icon#CURRENTSECTION#][!Redraw]
MouseLeaveAction=[!SetOption Icon#CURRENTSECTION# SolidColor 255,0,0][!UpdateMeter Icon#CURRENTSECTION#][!Redraw]
Padding=25,0,0,0
FontSize=12
Y=R
H=25

[IconStyle]
SolidColor=255,0,0
Y=R
W=25
H=25

;----------------

[1]
Meter=String
MeterStyle=StringStyle
Text=STRING #CURRENTSECTION#
Y=0

[2]
Meter=String
MeterStyle=StringStyle
Text=STRING #CURRENTSECTION#

[3]
Meter=String
MeterStyle=StringStyle
Text=STRING #CURRENTSECTION#

[4]
Meter=String
MeterStyle=StringStyle
Text=STRING #CURRENTSECTION#

[5]
Meter=String
MeterStyle=StringStyle
Text=STRING #CURRENTSECTION#

[6]
Meter=String
MeterStyle=StringStyle
Text=STRING #CURRENTSECTION#

[7]
Meter=String
MeterStyle=StringStyle
Text=STRING #CURRENTSECTION#

[8]
Meter=String
MeterStyle=StringStyle
Text=STRING #CURRENTSECTION#

[9]
Meter=String
MeterStyle=StringStyle
Text=STRING #CURRENTSECTION#

[10]
Meter=String
MeterStyle=StringStyle
Text=STRING #CURRENTSECTION#

[11]
Meter=String
MeterStyle=StringStyle
Text=STRING #CURRENTSECTION#

[12]
Meter=String
MeterStyle=StringStyle
Text=STRING #CURRENTSECTION#

[13]
Meter=String
MeterStyle=StringStyle
Text=STRING #CURRENTSECTION#

[14]
Meter=String
MeterStyle=StringStyle
Text=STRING #CURRENTSECTION#

[15]
Meter=String
MeterStyle=StringStyle
Text=STRING #CURRENTSECTION#

[16]
Meter=String
MeterStyle=StringStyle
Text=STRING #CURRENTSECTION#

[17]
Meter=String
MeterStyle=StringStyle
Text=STRING #CURRENTSECTION#

[18]
Meter=String
MeterStyle=StringStyle
Text=STRING #CURRENTSECTION#

[19]
Meter=String
MeterStyle=StringStyle
Text=STRING #CURRENTSECTION#

[20]
Meter=String
MeterStyle=StringStyle
Text=STRING #CURRENTSECTION#

;--------------

[Icon1]
Meter=Image
MeterStyle=IconStyle
Y=[1:Y]

[Icon2]
Meter=Image
MeterStyle=IconStyle

[Icon3]
Meter=Image
MeterStyle=IconStyle

[Icon4]
Meter=Image
MeterStyle=IconStyle

[Icon5]
Meter=Image
MeterStyle=IconStyle

[Icon6]
Meter=Image
MeterStyle=IconStyle

[Icon7]
Meter=Image
MeterStyle=IconStyle

[Icon8]
Meter=Image
MeterStyle=IconStyle

[Icon9]
Meter=Image
MeterStyle=IconStyle

[Icon10]
Meter=Image
MeterStyle=IconStyle

[Icon11]
Meter=Image
MeterStyle=IconStyle

[Icon12]
Meter=Image
MeterStyle=IconStyle

[Icon13]
Meter=Image
MeterStyle=IconStyle

[Icon14]
Meter=Image
MeterStyle=IconStyle

[Icon15]
Meter=Image
MeterStyle=IconStyle

[Icon16]
Meter=Image
MeterStyle=IconStyle

[Icon17]
Meter=Image
MeterStyle=IconStyle

[Icon18]
Meter=Image
MeterStyle=IconStyle

[Icon19]
Meter=Image
MeterStyle=IconStyle

[Icon20]
Meter=Image
MeterStyle=IconStyle
By naming the string section names 1, 2, 3, etc. you can reference any other series of corresponding meters (such as the icons in this example). This works fine. However, if I wanted to use this technique a second time in the same config, I couldn't. Because a meter can only be called 1, 2, 3, etc. once per config.

Using this technique can be a huge time saver when dealing with tens of hundreds of different individual meters that each need a corresponding meter.

If the user could store a value inside of a meter, rather than relying entirely on the section name for storage, it would allow this technique to have significantly more versatility.

So the [StringStyle] could look something like this:

Code: Select all

[Rainmeter]

[Variables]

[StringStyle]
SolidColor=0,255,0
MouseOverAction=[!SetOption Icon[#CURRENTSECTION#:StoredValue] SolidColor 255,255,255][!UpdateMeter Icon[#CURRENTSECTION#:StoredValue]][!Redraw]
MouseLeaveAction=[!SetOption Icon[#CURRENTSECTION#:StoredValue] SolidColor 255,0,0][!UpdateMeter Icon[#CURRENTSECTION#:StoredValue]][!Redraw]
Padding=25,0,0,0
FontSize=12
Y=R
H=25

[IconStyle]
SolidColor=255,0,0
Y=R
W=25
H=25

;----------------

[String1]
Meter=String
MeterStyle=StringStyle
Text=STRING 1
StoredValue=1
Y=0

[String2]
Meter=String
MeterStyle=StringStyle
Text=STRING 2
StoredValue=2

[String3]
Meter=String
MeterStyle=StringStyle
Text=STRING 3
StoredValue=3

[Icon1]
Meter=Image
MeterStyle=IconStyle
Y=[1:Y]

[Icon2]
Meter=Image
MeterStyle=IconStyle

[Icon3]
Meter=Image
MeterStyle=IconStyle
In this example, now we have assigned an individual value to each string meter in order for the style to understand what icon meter its !SetOption should correspond to. And since we didn't use [SectionNames] in order to do this, we can now use this technique multiple times throughout the config.

All it's doing is pulling the value from the meter in the same way that it would pull the value of X, Y, W, H using section variables. Except this value is user defined. It doesn't do anything. All it does it sit there and wait to be called.

So in OP's example, he could achieve what he wants by using [!SetOption [#CURRENTSECTION#:StoredValue] "SomeOption" "SomeValue"] with the StoredValue for [Background11] being 12.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Calculating next meter number

Post by eclectic-tech »

Okay! I see what you are looking for is an expansion of the Meter Section Variable capabilities beyond X, Y, W, H, XW, and YH.

The DevTeam would need to look at this feature. A bit niche use, but it has it's merit. :welcome: