It is currently June 16th, 2021, 11:13 am

Question about OnChangeAction

Help with creating, editing & fixing problems with skins
User avatar
CodeCode
Posts: 390
Joined: September 7th, 2020, 2:24 pm

Question about OnChangeAction

Post by CodeCode »

I have this Measure:

Code: Select all


[MeasureCPUTemp]
Measure=Plugin
Plugin=CoreTemp
CoreTempType=MaxTemperature
IfCondition=(MeasureCPUTemp >= 91)
IfTrueAction=[!SetOption MeterCPU FontColor "175,0,0"][!SetOption CPU LineColor "175,0,0"][!UpdateMeter "MeterCPU"][!UpdateMeter "CPU"][!Update]
IfCondition2=((MeasureCPUTemp >= 86) && (MeasureCPUTemp < 90))
IfTrueAction2=[!SetOption MeterCPU FontColor "195,155,0"][!SetOption CPU LineColor "195,155,0"][!UpdateMeter "MeterCPU"][!UpdateMeter "CPU"][!Update]
IfCondition3=(MeasureCPUTemp < 85)
IfTrueAction3=[!SetOption MeterCPU FontColor # #][!SetOption CPU LineColor #UsedL#][!UpdateMeter "MeterCPU"][!UpdateMeter "CPU"][!Update]
RegExpSubstitute=1
MinValue=0
MaxValue=102
I get an artifact that follows the temperature reaching higher temps and therefore the different colors will remain, until a manual refresh.
I tried OnChangeAction=[!UpdateMeter MeterCPU] but the artifact remained anyway.
Well eventually it would resolve but not always.
OnChangeAction=[!Update] Left the Cpu looking like and/or actually was pegged at 100%, so that was no go.

Is there a working solution for this?
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
death.crafter
Posts: 176
Joined: April 24th, 2021, 8:13 pm

Re: Question about OnChangeAction

Post by death.crafter »

CodeCode wrote: June 9th, 2021, 8:05 am I have this Measure:

Code: Select all


[MeasureCPUTemp]
Measure=Plugin
Plugin=CoreTemp
CoreTempType=MaxTemperature
IfCondition=(MeasureCPUTemp >= 91)
IfTrueAction=[!SetOption MeterCPU FontColor "175,0,0"][!SetOption CPU LineColor "175,0,0"][!UpdateMeter "MeterCPU"][!UpdateMeter "CPU"][!Update]
IfCondition2=((MeasureCPUTemp >= 86) && (MeasureCPUTemp < 90))
IfTrueAction2=[!SetOption MeterCPU FontColor "195,155,0"][!SetOption CPU LineColor "195,155,0"][!UpdateMeter "MeterCPU"][!UpdateMeter "CPU"][!Update]
IfCondition3=(MeasureCPUTemp < 85)
IfTrueAction3=[!SetOption MeterCPU FontColor # #][!SetOption CPU LineColor #UsedL#][!UpdateMeter "MeterCPU"][!UpdateMeter "CPU"][!Update]
RegExpSubstitute=1
MinValue=0
MaxValue=102
I get an artifact that follows the temperature reaching higher temps and therefore the different colors will remain, until a manual refresh.
I tried OnChangeAction=[!UpdateMeter MeterCPU] but the artifact remained anyway.
Well eventually it would resolve but not always.
OnChangeAction=[!Update] Left the Cpu looking like and/or actually was pegged at 100%, so that was no go.

Is there a working solution for this?
You need to [!Redraw] after you update a meter. And DynamicVariables=1 in meter.
from the Realm of Death
User avatar
balala
Rainmeter Sage
Posts: 12782
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Question about OnChangeAction

Post by balala »

death.crafter wrote: June 9th, 2021, 8:17 am You need to [!Redraw] after you update a meter. And DynamicVariables=1 in meter.
Sorry, but none of these is not correct:
  • Rainmeter redraws the skin at the end of each update cycle, So if the skin has the Update value set to Update=1000 ([Rainmeter] section) (which is usual the case of such skins, which has to follow the variation of a changing value, in this case the temperature), there is no need to manually redraw the skin, it is done automatically once per second (so the change will be seen after not more than one second).
  • Unlike !SetVariable, the !SetOption bang doesn't require to set the dynamic variables on meters and / or measure where the option is set. If you set a variable with the !SetVariable bang, it is, without a DynamicVariables=1 option the meter / measure doesn't see the dynamically set variable, however it does see the dyanmically set option (with a !SetOption bang). In fact when using the !SetOption bang, Rainmeter sets the dynamic variables on the meter or measure where the option is set, for one update cycle and this way explicitly adding the option is not needed.
User avatar
balala
Rainmeter Sage
Posts: 12782
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Question about OnChangeAction

Post by balala »

CodeCode wrote: June 9th, 2021, 8:05 am I get an artifact that follows the temperature reaching higher temps and therefore the different colors will remain, until a manual refresh.
I tried OnChangeAction=[!UpdateMeter MeterCPU] but the artifact remained anyway.
Well eventually it would resolve but not always.
This is happening only if the temperature is above 85 degrees, then drops below. It is caused by the fact that in the IfTrueAction3 option, there is not properly set a color. What the # # does mean in the first !SetOption bang of the appropriate option (IfTrueAction3=[!SetOption MeterCPU FontColor # #][!SetOption CPU LineColor #UsedL#][!UpdateMeter "MeterCPU"][!UpdateMeter "CPU"][!Update])? Not even quotations are used. I suppose it should be IfTrueAction3=[!SetOption MeterCPU FontColor "#UsedL#"][!SetOption CPU LineColor "#UsedL#"][!UpdateMeter "MeterCPU"][!UpdateMeter "CPU"][!Update]. Note that here I also added some quotations around the color codes (or in fact around the #UsedL# variables in both !SetOption bangs). Replace the color code (with correct color codes!!!) if this is not what you want to set.
One more: it is not needed to update the whole skin with [!Update] bangs on each IfTrueAction options, especially that the [MeterCPU] and [CPU] meters (which are changed by the !Setoption bangs) are already updated (by the [!UpdateMeter "MeterCPU"] and [!UpdateMeter "CPU"] bangs). So redrawing the skin is completely enough. Accordingly I'd replace the [!Update] bangs of the three IftrueAction options with [!Redraw].
User avatar
death.crafter
Posts: 176
Joined: April 24th, 2021, 8:13 pm

Re: Question about OnChangeAction

Post by death.crafter »

balala wrote: June 9th, 2021, 1:21 pm Sorry, but none of these is not correct:
  • Rainmeter redraws the skin at the end of each update cycle, So if the skin has the Update value set to Update=1000 ([Rainmeter] section) (which is usual the case of such skins, which has to follow the variation of a changing value, in this case the temperature), there is no need to manually redraw the skin, it is done automatically once per second (so the change will be seen after not more than one second).
  • Unlike !SetVariable, the !SetOption bang doesn't require to set the dynamic variables on meters and / or measure where the option is set. If you set a variable with the !SetVariable bang, it is, without a DynamicVariables=1 option the meter / measure doesn't see the dynamically set variable, however it does see the dyanmically set option (with a !SetOption bang). In fact when using the !SetOption bang, Rainmeter sets the dynamic variables on the meter or measure where the option is set, for one update cycle and this way explicitly adding the option is not needed.
Ahh I see. Lol I was in the dark for so long. Thanks for letting me know.
from the Realm of Death
User avatar
balala
Rainmeter Sage
Posts: 12782
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Question about OnChangeAction

Post by balala »

death.crafter wrote: June 9th, 2021, 3:48 pm Ahh I see. Lol I was in the dark for so long. Thanks for letting me know.
Yes, the need of dynamic variables when using !SetVariable and no-need for it when using !SetOption, is something which doesn't make too much sense, but this is the case and for backward compatibility issues it probably can't be fixed. We just have to pay attention to it.
User avatar
CodeCode
Posts: 390
Joined: September 7th, 2020, 2:24 pm

Re: Question about OnChangeAction

Post by CodeCode »

balala wrote: June 9th, 2021, 2:02 pm This is happening only if the temperature is above 85 degrees, then drops below. It is caused by the fact that in the IfTrueAction3 option, there is not properly set a color. What the # # does mean in the first !SetOption bang of the appropriate option (IfTrueAction3=[!SetOption MeterCPU FontColor # #][!SetOption CPU LineColor #UsedL#][!UpdateMeter "MeterCPU"][!UpdateMeter "CPU"][!Update])? Not even quotations are used. I suppose it should be IfTrueAction3=[!SetOption MeterCPU FontColor "#UsedL#"][!SetOption CPU LineColor "#UsedL#"][!UpdateMeter "MeterCPU"][!UpdateMeter "CPU"][!Update]. Note that here I also added some quotations around the color codes (or in fact around the #UsedL# variables in both !SetOption bangs). Replace the color code (with correct color codes!!!) if this is not what you want to set.
One more: it is not needed to update the whole skin with [!Update] bangs on each IfTrueAction options, especially that the [MeterCPU] and [CPU] meters (which are changed by the !Setoption bangs) are already updated (by the [!UpdateMeter "MeterCPU"] and [!UpdateMeter "CPU"] bangs). So redrawing the skin is completely enough. Accordingly I'd replace the [!Update] bangs of the three IftrueAction options with [!Redraw].
Cool. Thanks balala. For so long this has been incorrect, and I finally asked about it. All you said makes perfect sense. :thumbup:
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
balala
Rainmeter Sage
Posts: 12782
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Question about OnChangeAction

Post by balala »

CodeCode wrote: June 9th, 2021, 8:36 pm Cool. Thanks balala. For so long this has been incorrect, and I finally asked about it. All you said makes perfect sense. :thumbup:
I'm glad. :thumbup:
User avatar
CodeCode
Posts: 390
Joined: September 7th, 2020, 2:24 pm

Re: Question about OnChangeAction

Post by CodeCode »

Yep. My PC rarely gets that hot so it doesn't happen often. But certain games have a very high poly count in certain areas. So when it does happen, I'm like, 'gotta fix that someday...' Now it should be fine.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
balala
Rainmeter Sage
Posts: 12782
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Question about OnChangeAction

Post by balala »

CodeCode wrote: June 9th, 2021, 9:43 pm Yep. My PC rarely gets that hot so it doesn't happen often. But certain games have a very high poly count in certain areas. So when it does happen, I'm like, 'gotta fix that someday...' Now it should be fine.
:thumbup: