It is currently April 28th, 2024, 12:28 am

Change Tint on Double Click

Get help with creating, editing & fixing problems with skins
ElderGoose
Posts: 16
Joined: August 15th, 2012, 11:55 pm

Change Tint on Double Click

Post by ElderGoose »

Hello,
I'm trying to make an image change its tint when I double click it, however, I can't seem to get it to work. Here's what I have:

Code: Select all

[MeterImage]
Meter=IMAGE
ImageName=C:\Users\image.png
X=15
Y=0
H=50
ImageTint=0,0,0,255
LeftMouseDoubleClickAction=!SetVariable "ImageTint" "0,0,0,100"
Any Suggestions?
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Change Tint on Double Click

Post by Kaelri »

"ImageTint" is not a variable. What you want to do is change the ImageTint option on the meter. For that, use:

Code: Select all

LeftMouseDoubleClickAction=!SetOption "MeterImage" "ImageTint" "0,0,0,100"
(More information here.)
ElderGoose
Posts: 16
Joined: August 15th, 2012, 11:55 pm

Re: Change Tint on Double Click

Post by ElderGoose »

How then, could I decrement the alpha value each time I double click on it?
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Change Tint on Double Click

Post by Kaelri »

Ah, for that, you would use a variable. :) You can use mathematical formulas in many contexts, including bang commands, by enclosing them in parentheses. Example:

Code: Select all

[Variables]
MyVariable=255

...

[MeterImage]
Meter=IMAGE
ImageName=C:\Users\image.png
X=15
Y=0
H=50
ImageTint=0,0,0,#MyVariable#
LeftMouseDoubleClickAction=!SetVariable "MyVariable" "(#MyVariable#-20)"
DynamicVariables=1
Make sure that dynamic variables are enabled on the meter, so that it will respond when the variable changes.
ElderGoose
Posts: 16
Joined: August 15th, 2012, 11:55 pm

Re: Change Tint on Double Click

Post by ElderGoose »

Awesome, thanks!