It is currently May 1st, 2024, 8:21 pm

Enumeration Problem

Get help with creating, editing & fixing problems with skins
NewWave
Posts: 23
Joined: April 15th, 2012, 5:39 am

Enumeration Problem

Post by NewWave »

So...a stripped down version of a problem I've come across. I'm needing the "Text=???" fields to contain an integer, each of which, would increase by 1 only when its corresponding IfEqualAction is fired. Hopefully, along with the code, that will make sense. I've been fiddling with !SetOption, but no luck so far. Any guidance is appreciated.

Code: Select all

[measureA]
Measure=Calc
Formula=2

[measureB]
Measure=Calc
Formula=10

;...

[measureBlock3]
Measure=Calc
Formula=(3>measureA) && (3<=measureB) ? 1 : 0
IfEqualValue=1
;If this is the first truth, the following "Text=???" should be 1
IfEqualAction=!ShowMeter meterBlock3

[meterBlock3]
Meter=String
Text=???
X=0
Y=0
W=50
H=50
Hidden=1

[measureBlock4]
Measure=Calc
Formula=(4>measureA) && (4<=measureB) ? 1 : 0
IfEqualValue=1
;If this is the second truth, the following "Text=???" should be 2
IfEqualAction=!ShowMeter meterBlock4

[meterBlock4]
Meter=String
Text=???
X=50
Y=0
W=50
H=50
Hidden=1

;...
User avatar
KreAch3R
Posts: 608
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: Enumeration Problem

Post by KreAch3R »

You need both meterblock3 & meterblock4 to display the number of TRUE formulas? I can't really get why you need them both.

Because of that, I thought of an one-text solution. Variables will solve your problem. I think you can configure it to adjust to the two-texts version you may want.
Set these two variables in the beginning:

Code: Select all

a=0
b=0
and add this measure:

Code: Select all

[MeasureADD]
Measure=Calc
Formula=(#a#+#b# = 1) || (#a#+#b# = 2) ? #a#+#b# : 0
IfEqualValue=0
IfEqualAction=!SetOption MeterADD Text "???"
DynamicVariables=1

[MeterADD]
Meter=String
Text=[MeasureADD]
DynamicVariables=1
Your IfEqualActions have to set the variable "a" and "b" to 1, when they 're true.
Inactive, due to life changes. Send me a PM for any question.

Desktop DeviartArt
Image
NewWave
Posts: 23
Joined: April 15th, 2012, 5:39 am

Re: Enumeration Problem

Post by NewWave »

Thanks for your help. :) I really appreciate it.

I don't think I explained the problem very well. I'm sorta all over the place in my head trying to figure out how to approach this.
Let me try to give a better explanation of what I wish to achieve:

There are several measure/meter pairs...
[measure1...]
[meter1....]

[measure2...]
[meter2...]

etc.

All meters are initially hidden.
Each measure contains an IfValue/Action. When the IfValue is TRUE, the IfAction is told to unhide the paired meter.

I need each shown meter to display a number, that is +1 greater than the last shown meter.

I hope that makes sense. Thanks again.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Enumeration Problem

Post by jsmorley »

NewWave wrote:Thanks for your help. :) I really appreciate it.

I don't think I explained the problem very well. I'm sorta all over the place in my head trying to figure out how to approach this.
Let me try to give a better explanation of what I wish to achieve:

There are several measure/meter pairs...
[measure1...]
[meter1....]

[measure2...]
[meter2...]

etc.

All meters are initially hidden.
Each measure contains an IfValue/Action. When the IfValue is TRUE, the IfAction is told to unhide the paired meter.

I need each shown meter to display a number, that is +1 greater than the last shown meter.

I hope that makes sense. Thanks again.
Sorry, no it really doesn't. You have several measures that return some value. Based on the value, you want them to unhide some meter. What does the first meter display? The value of the first measure? Something else entirely? If the second measure causes the second meter to be shown, what value do you expect that meter to display? The value of the second measure? If you somehow want the second meter to "read" the value of the first meter and add 1 to it, that cannot be done. Meters don't have "values" you can read, only measures.

There is no doubt a way to get what you want with a couple of extra measures, but I'm really stumped on what you are trying to achieve. Lay out an example or something.
NewWave
Posts: 23
Joined: April 15th, 2012, 5:39 am

Re: Enumeration Problem

Post by NewWave »

Code: Select all

;Two quick measures for use in the example
[measureA]
Measure=Calc
Formula=2

[measureB]
Measure=Calc
Formula=10
;--------------------------------------------

[measure1]
Measure=Calc
Formula=(1>measureA) && (1<=measureB) ? 1 : 0
IfEqualValue=1
IfEqualAction=!ShowMeter meter1

[meter1]
Meter=String
X=0
Y=0
W=50
H=50
Hidden=1

[measure2]
Measure=Calc
Formula=(2>measureA) && (2<=measureB) ? 1 : 0
IfEqualValue=1
IfEqualAction=!ShowMeter meter2

[meter2]
Meter=String
X=50
Y=0
W=50
H=50
Hidden=1

[measure3]
Measure=Calc
Formula=(3>measureA) && (3<=measureB) ? 1 : 0
IfEqualValue=1
IfEqualAction=!ShowMeter meter3

[meter3]
Meter=String
X=0
Y=50
W=50
H=50
Hidden=1

[measure4]
Measure=Calc
Formula=(4>measureA) && (4<=measureB) ? 1 : 0
IfEqualValue=1
IfEqualAction=!ShowMeter meter4

[meter4]
Meter=String
X=50
Y=50
W=50
H=50
Hidden=1
Currently, the sole purpose of the measures is to unhide the meter with the corresponding name(e.g. measure1 will unhide meter1) but only when the "IfEqualValue=1" is TRUE.
In the above example, measure1 and measure2 should return 0, thereby keeping meter1 and meter2 hidden.
measure 3 should return 1, thereby meter3 becoming the first shown meter. I want this meter to display the number 1.
measure 4 should return 1, thereby meter4 becoming the second shown meter. I want this meter to display the number 2.
If meter5 did not get shown, but meter6 did, meter6 would need to display the number 3.
I know the current meters are not linked to anything yet, and will need to be.

Thanks again.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Enumeration Problem

Post by jsmorley »

But that is the point of what I don't get... You have a short-term and a long-term goal here that are conflicting. You want a blank, vanilla meter to just display a "1" or "2" depending on if it is the first or second "unhidden" meter. Ok, that can probably be done with some reasonably complicated Calc measure(s) that evaluate the values of all the other measures to see which are "true" and which are "false" and then uses !SetOption to set the Text= value of the meters. What you can't do is have one meter "know" what is being displayed by some other meter. Doesn't work that way.

So If we figure out how to get that much working, where are we? As soon as you change the meters to actually display some real value from a measure, the effort to have them display "1" or "2" is lost and of no value that I can envision.

I just am not getting where you are going with this and what you are trying to accomplish. Maybe it is just too early in the morning. I think someone else will have to jump in, I surrender.
NewWave
Posts: 23
Joined: April 15th, 2012, 5:39 am

Re: Enumeration Problem

Post by NewWave »

jsmorley wrote:What you can't do is have one meter "know" what is being displayed by some other meter.
Could not something(a measure or variable) be enumerated in increments of 1? I guess the problem there would be that every meter would display the most recent value.

I surrender as well. :? :D
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Enumeration Problem

Post by jsmorley »

If what you are asking is if there is some way for Rainmeter to know and use the fact that [MeterA] is the "first" meter displayed (not just the first meter in the skin, but the first "unhidden" one) and that [MeterC] is the second meter displayed (with [MeterB] still hidden), then the answer is no.

As I said, we might be able to concoct some complicated Calc measures(s) that could for instance set variables like MeterA=1, MeterB=-1, MeterC=2 depending one which meters are hidden or not, but then I fail to see what that buys us.
User avatar
KreAch3R
Posts: 608
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: Enumeration Problem

Post by KreAch3R »

I'm totally confused, too. I can't see where this is going. Maybe if you explain to us the concept of the skin, it will make sense. :)
Inactive, due to life changes. Send me a PM for any question.

Desktop DeviartArt
Image