It is currently September 21st, 2020, 1:13 pm

ConfigActive returns -1 after Game Mode used

Report bugs with the Rainmeter application and suggest features.
User avatar
Lieuallen
Posts: 20
Joined: June 8th, 2020, 11:56 pm
Location: USA

ConfigActive returns -1 after Game Mode used

Post by Lieuallen »

I have a skin that monitors other skins via ConfigActive. Works as intended. But, if I use Game Mode, when I reactivate Rainmeter, ConfigActive returns -1 for all skins (even those that are now active again). Refreshing the skin fixes this.

If there's a bug, I suspect it's in my code or logic! Here are what I think are the relevant bits (I actually have 12 "MeasureActive" sections, but they are all the same, just for different skins)....

Code: Select all

[Rainmeter]
Update=-1

[Variables]
Transp=160
WANum=0
CPUNum=1

[MeasureActive1]
Measure=Plugin
Plugin=ConfigActive
ConfigName=Sensors\AudioPlayer
IfCondition=#CURRENTSECTION# = 1
IfTrueAction=[!SetVariable WANum "1"]
IfFalseAction=[!SetVariable WANum "0"]

[MeasureActive2]
Measure=Plugin
Plugin=ConfigActive
ConfigName=Sensors\CPU and RAM
IfCondition=#CURRENTSECTION# = 1
IfTrueAction=[!SetVariable CPUNum "1"]
IfFalseAction=[!SetVariable CPUNum "0"]

[Shp_Player]
Meter=Shape
Shape=Rectangle 0,1,121,20 | Fill Color 0,0,0,#Transp# | StrokeWidth 1 | Stroke Color 128,128,128,(#Transp# + 32)
LeftMouseUpAction=[!CommandMeasure mPlayer TogglePlayer][!ToggleConfig "Sensors\AudioPlayer" "Player.ini"][!UpdateMeasure "MeasureActive1"][!UpdateMeter "Btn_Player"][!ReDraw]

[Btn_Player]
Meter=Image
ImageName=#@#Btn_#WANum#.png
X=3
Y=1
DynamicVariables=1

[Shp_CPU]
Meter=Shape
Shape=Rectangle 0,21,60,20 | Fill Color 0,0,0,#Transp# | StrokeWidth 1 | Stroke Color 128,128,128,#Transp# + 32
LeftMouseUpAction=[!ToggleConfig "Sensors\CPU and RAM" "CPU and RAM.ini"][!UpdateMeasure "MeasureActive2"][!UpdateMeter "Btn_CPU"][!ReDraw]

[Btn_CPU]
Meter=Image
ImageName=#@#Btn_#CPUNum#.png
X=3
Y=22
DynamicVariables=1
Basically, I'm using the variables to keep track of whether the other "Sensors" skins are active or not, and then display the appropriate button graphic (e.g. Btn_0.png for off and Btn_1.png for on). I've used Update=-1 because I only need the measures to update when they are LeftClicked.

I've been using this for more than a month now with no issues. Two days ago, I used Game Mode for the first time. Pretty cool! But when I reactivate Rainmeter, all the button graphics are "off" (in the Log all the MeasureActive values are -1, and therefore all the variables tracking the measures are 0). Refreshing the skin turns all the buttons to the correct state.

So the problem seems to be that upon "awakening" from Game Mode, ConfigActive is returning -1 even if the specified ConfigName skin is active. Is it a timing thing (is ConfigActive too quick, and the other skins haven't finished loading yet)?

I'm using Rainmeter 4.4.0.3399 and ConfigActive 2.2.1.0 in 64-bit Windows 7.

Thanks!

P.S. Just as a kludge, I tried using OnRefreshAction=[!Update], but that didn't work.
"Imagination is more important than knowledge." -- Albert Einstein
User avatar
balala
Rainmeter Sage
Posts: 11374
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: ConfigActive returns -1 after Game Mode used

Post by balala »

Lieuallen wrote: August 16th, 2020, 11:11 am I have a skin that monitors other skins via ConfigActive. Works as intended. But, if I use Game Mode, when I reactivate Rainmeter, ConfigActive returns -1 for all skins (even those that are now active again). Refreshing the skin fixes this.
This is going on only if you set the Update value into the [Rainmeter] section to Update=-1 (which you did). This means the skin is never updated, except the very first moment, when you load / refresh it.
Changing the Update to the default Update=1000 fixes the issue.
User avatar
Lieuallen
Posts: 20
Joined: June 8th, 2020, 11:56 pm
Location: USA

Re: ConfigActive returns -1 after Game Mode used

Post by Lieuallen »

That makes perfect sense. As I suspected, the bug was ME! I assumed that when "re-activating" from Game Mode, an update cycle would run. But because I set Update=-1, it apparently doesn't.

So, if I may, I'd like to convert this to a feature request. I'd like to ask that a single update cycle be triggered when exiting Game Mode. Who knows what shenanigans have been going on while Rainmeter was "asleep". Seems like an Update might be a good idea?
"Imagination is more important than knowledge." -- Albert Einstein
User avatar
balala
Rainmeter Sage
Posts: 11374
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: ConfigActive returns -1 after Game Mode used

Post by balala »

Lieuallen wrote: August 16th, 2020, 5:05 pm That makes perfect sense. As I suspected, the bug was ME!
No, you are not a "bug". Not knowing something, doesn't mean you are a "bug". You'll realize a lot of things if you keep working in Rainmeter.
Lieuallen wrote: August 16th, 2020, 5:05 pm So, if I may, I'd like to convert this to a feature request. I'd like to ask that a single update cycle be triggered when exiting Game Mode. Who knows what shenanigans have been going on while Rainmeter was "asleep". Seems like an Update might be a good idea?
Not needed, in my opinion. Some skins (for instance those using the ConfigActive plugin, or WebParser measures) make no sense if are used without update. For example a such skin using the ConfigActive plugin, has to be updated to can immediately reacto the loading / unloading of the appropriate config. If you're using it with Update=-1, it simply never will see if the loading of the config is changing. The best possible approach for these kind of skins is the default Update=1000. Recommend using it.
User avatar
Yincognito
Posts: 2565
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ConfigActive returns -1 after Game Mode used

Post by Yincognito »

One can also use Update=1000 and DefaultUpdateDivider=-1 to set such a negative update rate for everything in the skin, and then just set UpdateDivider=1 on the ConfigActive measures, to make an exception and update it once a second...