It is currently April 23rd, 2024, 8:26 am

Formulas and WriteKeyValue

Get help with creating, editing & fixing problems with skins
User avatar
CodeCode
Posts: 1365
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Formulas and WriteKeyValue

Post by CodeCode »

I am using !WriteKeyValue to change between two formulas.
This problem is that the formulas are really meant to be dynamic. But when !WriteKeyValue is used - to maintain the values after any kind of Refresh of rainmeter - the formulas remain in the literal value - that is to say the Measures being referenced in the formulas - are being written literally rather than in the formula form they really need to be in.
This is the formula before it is Written as a Key Value:
Arc (97+(97)*cos(rad(90+360*[MeasureTempforScaling:%]/100))),(97+(97)*sin(rad(90+360*[MeasureTempforScaling:%]/100))), (97+(97)*cos(rad(90+3+360*[MeasureTempforScaling:%]/100))),(97+(97)*sin(rad(90+3+360*[MeasureTempforScaling:%]/100))), 97, 97 | StrokeWidth 6 | Stroke Color 0,0,0,255
This is the formula after Written as a Key Value:
Arc (97+(97)*cos(rad(90+360*40/100))),(97+(97)*sin(rad(90+360*40/100))), (97+(97)*cos(rad(90+3+360*40/100))),(97+(97)*sin(rad(90+3+360*40/100))), 97, 97 | StrokeWidth 6 | Stroke Color 0,0,0,255
Is there a way to make the former form persist, rather than the latter?

Thanks for any suggestions or corrections.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Formulas and WriteKeyValue

Post by jsmorley »

CodeCode wrote: August 16th, 2021, 2:16 pm I am using !WriteKeyValue to change between two formulas.
This problem is that the formulas are really meant to be dynamic. But when !WriteKeyValue is used - to maintain the values after any kind of Refresh of rainmeter - the formulas remain in the literal value - that is to say the Measures being referenced in the formulas - are being written literally rather than in the formula form they really need to be in.
This is the formula before it is Written as a Key Value:
Arc (97+(97)*cos(rad(90+360*[MeasureTempforScaling:%]/100))),(97+(97)*sin(rad(90+360*[MeasureTempforScaling:%]/100))), (97+(97)*cos(rad(90+3+360*[MeasureTempforScaling:%]/100))),(97+(97)*sin(rad(90+3+360*[MeasureTempforScaling:%]/100))), 97, 97 | StrokeWidth 6 | Stroke Color 0,0,0,255
This is the formula after Written as a Key Value:
Arc (97+(97)*cos(rad(90+360*40/100))),(97+(97)*sin(rad(90+360*40/100))), (97+(97)*cos(rad(90+3+360*40/100))),(97+(97)*sin(rad(90+3+360*40/100))), 97, 97 | StrokeWidth 6 | Stroke Color 0,0,0,255
Is there a way to make the former form persist, rather than the latter?

Thanks for any suggestions or corrections.
*Escape* any #*Variables*# or [*SectionVariables*] that you want to be written as a literal instead of being resolved first.

https://docs.rainmeter.net/manual/variables/#Escape
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Formulas and WriteKeyValue

Post by eclectic-tech »

This can be a "stumbling block" when you want the written value to be dynamic.

There is a link, in the !SetOption description, to a guide that explains this. But there is not one in the !WriteKeyValue description.

Would it help to add a note about this to the !WriteKeyValue description in the documentation?
User avatar
CodeCode
Posts: 1365
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Formulas and WriteKeyValue

Post by CodeCode »

jsmorley wrote: August 16th, 2021, 2:26 pm *Escape* any #*Variables*# or [*SectionVariables*] that you want to be written as a literal instead of being resolved first.

https://docs.rainmeter.net/manual/variables/#Escape
Awesome! Thanks. I guessed that an 'escape' would be needed, just not what form it would take. There are a few to choose from. Perhaps if I read more closely, it would have been clearer without asking. Anyways, this is really good to know. Having flexibility on how section variables can be made even more dynamic, is pretty cool stuff.

Thanks.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.