Chewtoy wrote:For the shifting meter part it gets a little more tricky.
There are different ways to go about this and mine is probably not the best one (alex or someone will probably make something really simple that requires a lot less code), but I would probably do something like this.
Code: Select all
[Variables]
Type=1
[MTemp]
Measure=TheMeasureYouHaveForYourTemps
[MVolts]
Measure=TheMeasureYouHaveForYourVolts
[CType]
Measure=Calc
Formula=((#Type#+1) > 1) ? 0 : #Type#+1
DynamicVariables=1
[SType]
Measure=Calc
Formula=#Type#
DynamicVariables=1
Substitute="1":"MTemp","0":"MVolts"
[Info]
Meter=Roundline
Measure=[SType]
X
Y
asda
asddf
LeftMouseUpAction=!Execute [!RainmeterWriteKeyValue Variables Type [CType]][!RainmeterRefresh]
DynamicVariables=1
You're right, I'm totally coming in here and stealing your thunder. First and foremost, if all you're doing with CType is using it to switch #Type# between 1 and 0, then you coulld have gotten rid of it and just done the switch within RainmeterWriteKeyValue. Like RainmeterSetVariable, if you put the value you want to use within parenthesis, it will assume that it's a formula and perform the calculation before assigning a value. So instead of the CType measure, you could just have used "[!RainmeterWriteKeyValue Variable Type (#Type#=0)]". That's kind of irrelevant though since overall the switch wasn't working anyway.
When I tested that out, it seemed that Rainmeter had no problem reading the MeasureName from a dynamic variable, but it refused to change the it afterward. Because all of the measures (at least the calcs) always start at 0 at the very start, the [Info] would only ever measure MVolts.
To fix it, I added a variable, Ring1, which would hold the name of the measure for the Roundline to use and pointed its MeasureName to that variable. Then, when you click it to change the measure, it also writes the value of SType to Ring1 (for some reason that I can't remember I renamed SType to MeasRing1 in my example, but they do the same thing). Then the skin is refreshed and the right measure is read. It's a little bit more roundabout than I would like, but it works.
As for lining up the roundlines properly, there's a very simple way to do it. Just make the X, Y width and height the same for all of them. Then in each roundline all you need to set are the LineStart and LineLength values to change the size of them. When you set a width and a height for a Roundline, it assumes that the center of the circle will be the center of the box you specified, regardless of the sizes. Also, StartAngle and RotationAngle will also both line up for all of the rings.
Here's an example of all of this working together. There are three rings and 6 measures being read. Well... It's really just two measures that I tripled, but it's the same idea. One set of measures will make the rings bounce back and forth between full and empty, the other will have them fill up all the way and then reset, and clicking the skin will switch between them. It should be easy enough to expand on it: just duplicate the sections as needed and tweak the numbers to suit your needs.
Code: Select all
[Rainmeter]
Update=100
[Variables]
Type=1.000000
Ring1=Meas1
Ring2=Meas2
Ring3=Meas3
[CheckType]
Measure=Calc
Formula=#Type#
DynamicVariables=1
[Meas1]
Measure=Calc
Formula=Counter % 25
MaxValue=25
[Meas2]
Measure=Calc
Formula=Counter % 25
MaxValue=25
[Meas3]
Measure=Calc
Formula=Counter % 25
MaxValue=25
[Meas4]
Measure=Calc
Formula=COS((Counter % 30)/30*PI*2)+1
MaxValue=2
[Meas5]
Measure=Calc
Formula=COS((Counter % 30)/30*PI*2)+1
MaxValue=2
[Meas6]
Measure=Calc
Formula=COS((Counter % 30)/30*PI*2)+1
MaxValue=2
[MeasRing1]
Measure=Calc
Formula=#Type#
Substitute=".0":"","1":"Meas4","0":"Meas1"
DynamicVariables=1
[MeasRing2]
Measure=Calc
Formula=#Type#
Substitute=".0":"","0":"Meas2","1":"Meas5"
[MeasRing3]
Measure=Calc
Formula=#Type#
Substitute=".0":"","0":"Meas3","1":"Meas6"
[Ring1]
Meter=Roundline
MeasureName=#Ring1#
W=300
H=300
LineStart=135
LineLength=150
LineColor=0,128,128,128
Solid=1
DynamicVariables=1
SolidColor=0,0,0,1
LeftMouseUpAction=!Execute [!RainmeterWriteKeyValue Variables Type (#Type#=0)][!RainmeterWriteKeyValue Variables Ring1 [MeasRing1]][!RainmeterWriteKeyValue Variables Ring2 [MeasRing2]][!RainmeterWriteKeyValue Variables Ring3 [MeasRing3]][!RainmeterRefresh]
AntiAlias=1
[Ring2]
Meter=Roundline
MeasureName=#Ring2#
W=300
H=300
LineStart=115
LineLength=130
LineColor=0,128,128,128
Solid=1
DynamicVariables=1
AntiAlias=1
[Ring3]
Meter=Roundline
MeasureName=#Ring3#
W=300
H=300
LineStart=95
LineLength=110
LineColor=0,128,128,128
Solid=1
DynamicVariables=1
AntiAlias=1
Also, there's one other thing I would like to address:
oni5115 wrote:In most programming languages you can use arrays/loops/functions to load/calculate variables. Is there something similar for RainMeter?
It should be stressed that Rainmeter is not, nor does it use a programming language. There is no program flow, there are no data types and there are barely even variables. It's best if you think about it as a list of settings. Each setting is given a value in the .ini file and Rainmeter reads through them to decide what is shown on the screen. While some of the settings, like the Calc measure's "Formula" setting, can be fairly complex, they are settings nonetheless. The Calc measure, Bangs and Dynamic Variables all help to blur this fact by introducing a much more complex and dynamic aspect to Rainmeter, but they do not a programming language make. If you are a programmer, then some of the logic and lateral thinking you're used to could be applied to creating a Rainmeter skin, especially once you start getting complicated, but you should never pursue the conventions or techniques used in programming languages since they will largely not apply.
That doesn't really have anything to do with your problem, and it's not really directed at you personally. It's just something I think should be put out on the table whenever it comes up.