It is currently May 22nd, 2024, 8:10 am

Confusion with !SetVariables

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7302
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Confusion with !SetVariables

Post by Yincognito »

jsmorley wrote: May 7th, 2020, 1:19 pm You are correct.
But you are too. :D
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16252
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Confusion with !SetVariables

Post by balala »

Yincognito wrote: May 7th, 2020, 1:18 pm You're right, but this won't work on @Includes, if I'm not mistaken, right? The OP "saved" his variable in an .inc file he used in the skin, thus...
Yes, but on the same IfTrueAction option a !setVariable is used to dynamically set the value of the variable, besides writing it to the appropriate .inc file. If you are using a !Refresh bang as well on the same option, the !SetVariable is completely useless. It loses its meaning...
User avatar
jsmorley
Developer
Posts: 22634
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Confusion with !SetVariables

Post by jsmorley »

balala wrote: May 7th, 2020, 1:32 pm Yes, but on the same IfTrueAction option a !setVariable is used to dynamically set the value of the variable, besides writing it to the appropriate .inc file. If you are using a !Refresh bang as well on the same option, the !SetVariable is completely useless. It loses its meaning...
It's a judgement call. If you can use a combination of [!SetVariable / !SetOption][!WriteKeyValue][!UpdateMeasure][!UpdateMeter][!Redraw], then you can kind of have your cake and eat it too, since you can update without the visible destruction and recreation of meters, while storing the change so it is persistent when you DO reload the skin. It's going to depend on the skin when this makes more sense than just writing the value and doing !Refresh.
User avatar
balala
Rainmeter Sage
Posts: 16252
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Confusion with !SetVariables

Post by balala »

jsmorley wrote: May 7th, 2020, 1:37 pm It's a judgement call. If you can use a combination of [!SetVariable / !SetOption][!WriteKeyValue][!UpdateMeasure][!UpdateMeter][!Redraw], then you can kind of have your cake and eat it too, since you can update without the visible destruction and recreation of meters, while storing the change so it is persistent when you DO reload the skin. It's going to depend on the skin when this makes more sense than just writing the value and doing !Refresh.
Yes, but if you add all those bangs, even if a refresh can be done, it doesn't make too much sense. Yep, there might be cases when it makes, however in most it doesn't.
User avatar
Ryn
Posts: 18
Joined: May 7th, 2020, 8:11 am

Re: Confusion with !SetVariables

Post by Ryn »

Thank's all for the replies. I'll try out the WriteKeyValue thing and see if that works. The only reason I worry about the lag is the fact that the screen says one thing but was saving a bit behind and I don't want people to lose progress. Hopefully Updating the measure will help.
I do have one more piece that is acting up too if you don't mind giving it a look.

Code: Select all

[ButtonCancel]
Meter=IMAGE
DynamicVariable=1
ImageName=\UI\Images\ButtonCancel 
LeftMouseUpAction=[!SetOption Screen ImageName \UI\Images\Screen.png][!SetVariable FontColour 255,255,255,255][!SetVariable InfoColour 255,255,255,0][!SetOption PlayerSprite ImageTint 255,255,255,255][!SetVariable ResetTint 255,255,255,0][!Update]
MouseOverAction=[!SetOption ButtonCancel ImageName \UI\Images\ButtonCancelPress.png]
MouseLeaveAction=[!SetOption ButtonCancel ImageName \UI\Images\ButtonCancel.png]
ImageTint=#ButtonTint#
Greyscale=1
X=164
Y=201
W=14
L=14

[ButtonReset]
Meter=IMAGE
ImageName=\UI\Images\Reset
DynamicVariable=1
LeftMouseUpAction=[!SetOption Screen ImageName \UI\Images\InfoScreen.png][!SetVariable FontColour 255,255,255,0][!SetVariable InfoColour 255,255,255,0][!SetOption PlayerSprite ImageTint 255,255,255,0][!SetVariable ResetTint 255,255,255,255]
MouseOverAction=[!SetOption ButtonReset ImageName \UI\Images\ResetHover.png]
MouseLeaveAction=[!SetOption ButtonReset ImageName \UI\Images\Reset.png]
ImageTint=#ButtonTint#
Greyscale=1
X=200
Y=20
W=5
L=5

[ResetConfirm]
Meter=IMAGE
DynamicVariable=2
ImageTint=#ResetTint#
ImageName=\UI\Images\ResetYes.png
LeftMouseUpAction=
MouseOverAction=[!SetOption ResetConfirm ImageName \UI\Images\ResetYesHover.png]
MouseLeaveAction=[!SetOption ResetConfirm ImageName \UI\Images\ResetYes.png]
X=55
Y=130
W=80
L=80
The first two blocks are supposed to affect the variable "ResetTint" and they do, but only after I mouse over the ResetConfirm Button. Any idea why this might be?

EDIT: The WriteKeyValue worked perfectly thank you!
User avatar
balala
Rainmeter Sage
Posts: 16252
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Confusion with !SetVariables

Post by balala »

Ryn wrote: May 7th, 2020, 1:46 pm The first two blocks are supposed to affect the variable "ResetTint" and they do, but only after I mouse over the ResetConfirm Button. Any idea why this might be?
But they are affecting that variable immediately when you're clicking them. At least the value of the ResetTint is set immediately when I click those meters.
But not having the needed images, it's hard to say something more precise. If you add a String meter to your code with a Text=#ResetTint# option along with a DynamicVariables=1, you'll see how is the ResetTint variable changing when you're clicking any of those buttons. Make sure it isn't changing and if indeed isn't, please pack the whole config and upload the package here. As said, I'd need those image files used by the code.
User avatar
Ryn
Posts: 18
Joined: May 7th, 2020, 8:11 am

Re: Confusion with !SetVariables

Post by Ryn »

Sorry for the late reply. This is what happens right now.
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16252
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Confusion with !SetVariables

Post by balala »

Ryn wrote: May 7th, 2020, 10:04 pm This is what happens right now.
Yes, but what the problem is? Additionally we don't have the needed files, some images would be required. You didn't share the needed resources.
So, first please post a package, which includes the needed resources, as well as the skin's code. Without them no one can help furtherly.
User avatar
Ryn
Posts: 18
Joined: May 7th, 2020, 8:11 am

Re: Confusion with !SetVariables

Post by Ryn »

Try hitting the ResetButton (Image Included in Files), and then the Cancel Button once you get the confirmation to appear.
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16252
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Confusion with !SetVariables

Post by balala »

Ryn wrote: May 8th, 2020, 8:32 am Try hitting the ResetButton (Image Included in Files), and then the Cancel Button once you get the confirmation to appear.
Not sure. First the purple background isn't even shown. Secondly when I click the buttons you talking about, the Lv:XX value increments, but this is all what I see. What else should I see?