David3214 wrote:Thank you for your response Balala, you did solve one of my issues. Could you maybe describe how you can evaluate the value of #CURRENTSECTION# and get the percent?
#CURRENTSECTION# is a
built-in variable and represents the name of the meter / measure where is used. Because in the posted code I used that variable into the [MeasurePercent] measure, there #CURRENTSECTION# is MeasurePercent. So for example in the first Ifcondition option instead of
IfCondition=(#CURRENTSECTION#=0) we have there
IfCondition=(MeasurePercent=0). The measure returns the appropriate percent and the IfCondition options compare the returned percent with the numeric values set in those options.
David3214 wrote:As I said previously I am new to Rainmeter, though have spent some time working in C#, C++, and Python.
The best would be to forget your programming knowledge, regardless what are those (C#, C++, Python or anything else). At least while you're working with Rainmeter. Rainmeter is not a programming language:
https://forum.rainmeter.net/viewtopic.php?p=136142#p136142
David3214 wrote:In terms of faded hearts, I meant in terraria when you lose hearts they still show up but faded and smaller. I have a separate image for this, because I thought it would be simpler than trying to transform the image with Rainmeter. I understand that I could do a show/hide for each of these as well, and may do that until I find a more condensed way.
In this case you should have to create another 21 "faded" meters, naming them for example as [FadeRH1] - [FadeRH21]. these meters obviously should contain the appropriate faded images.
Then you have to add in the posted IftrueAction options after each
[!ShowMeter "RHXX"] and
[!HideMeter "RHYY"] bangs, another one bang, to show the appropriate faded image, if the normal one is hidden and hide it, if the normal image is shown (accordingly
[!HideMeter "FadeRHXX"] respectively
[!ShowMeter "FadeRHYY"]). Eg the first two bangs of the IfTrueAction option should be replaced by
IfTrueAction=[!ShowMeter "RH1"][!HideMeter "FadeRH1"][!HideMeter "RH2"][!ShowMeter "FadeRH2"]. This way every time when a meter is shown its appropriate faded meter is hidden and vice-versa: when a meter is hidden, its faded version is shown.
But the same well you could create just one set of image meters (the existing [RH1] - [RH21] meters), without the ImageName options, then set the name of image accordingly, depending on which image should be shown by that meter. Remaining on the previous example, instead of the
IfTrueAction=[!ShowMeter "RH1"][!HideMeter "FadeRH1"][!HideMeter "RH2"][!ShowMeter "FadeRH2"] bangs, you should use this:
IfTrueAction=[!SetOption RH1 ImageName "#@#images\RH.png"][!SetOption HideMeter RH2 "#@#images\FadeRH.png"].This way each of those !SetOption bangs will set the appropriate image for the appropriate image meter, depending on the percentage returned by the [MeasurePercent] measure.
David3214 wrote:One thing I wonder is there a more condensed way to do this, instead of writing out 20+ show/Hide statemets, and creating 20+ meters. Are there arrays or such in Rainmeter that you could store these in at all?
Not really in Rainmeter, because as I said above, it isn't a procedural programming language. Sorry...
David3214 wrote:My last big question/Issue is how can I also test for whether the computer is plugged in? Currently all the hearts of Gold, but I want to be able to change all of the hearts to a golden color (a separate image) if it is plugged in. Could you describe how I could do this. Assume that the Meter's for the golden hearts are named [GH1]-[GH20].
If you want to do this, first I'd recommend to stay on the !ShowMeter / !HideMeter solution and don't use the !SetOption solution, described above.
The following plugin measure returns 0 when the computer works on battery and 1 if it's plugged in:
Code: Select all
[MeasureAC]
Measure=Plugin
PlugIn=PowerPlugin
PowerState=ACLINE
A set of IfCondition options could be used to set the appropriate image in both cases:
Code: Select all
[MeasureAC]
Measure=Plugin
PlugIn=PowerPlugin
PowerState=ACLINE
IfCondition=(#CURRENTSECTION#=1)
IfTrueAction=[!SetOption RH1 ImageName "#@#images\RH-FOR-BATTERY.png"][!SetOption FadeRH1 ImageName "#@#images\FADE-RH-FOR-BATTERY.png"]...
IfFalseAction=[!SetOption RH1 ImageName "#@#images\RH-FOR-PLUGGED-IN.png"][!SetOption FadeRH1 ImageName "#@#images\FADE-RH-FOR-PLUGGED-IN.png"]...
Obviously you have to set on both options the images for all the RHXX meters. Also keep in mind this solution works only if you're using the previously described first solution, where we had two sets of meters, with different images. The second solution, which sets the appropriate image depending on the percentage, won't work in this case.
I hope these explanations was clear enough and you've understood. Please let me know if something isn't clear enough.