It is currently April 18th, 2024, 10:43 am

Activate 2 skins alternately on MouseOver

Get help with creating, editing & fixing problems with skins
rayman13579
Posts: 2
Joined: July 15th, 2017, 8:54 pm

Activate 2 skins alternately on MouseOver

Post by rayman13579 »

Hello,

this is pretty long, so there's a TL;DR in the end if you're interested.

I have 2 skins. The first one Activates the other one on MouseOver, here they are:
The first one

Code: Select all

[MHO]
Meter=Image
ImageName=#@#Icons\mho.png
X=-12
Y=-3
W=100
H=100
LeftMouseUpAction=["C:\Program Files\TencentGame\Monster Hunter Online\TCLS\client.exe"]
MouseOverAction=[!ActivateConfig "Honeycomb\mho\Wallpapers" "mho.ini"][!Hide "BOTW"]
MouseLeaveAction=[!DeactivateConfig "Honeycomb\mho\Wallpapers" "mho.ini"]
and the one getting activated

Code: Select all

[Rainmeter]
OnRefreshAction=!ZPos "-2"

[Wallpaper]
Meter = Image
W=#SCREENAREAWIDTH#
H=#SCREENAREAHEIGHT#
ImageName = mho.jpg
MouseOverAction=[!Show "BOTW"]
As you can see if I hover over the first skin an image will be shown. Now I want that if I hover over the first skin the second skin should activate, but if I hover over it a 2nd time a 3rd skin should activate (basically just another image, if it would be easier). On the 3rd hover however it should show the first image again, and so on.

I already tried this:

Code: Select all

[MHO]
Meter=Image
ImageName=#@#Icons\mho.png
X=-12
Y=-3
W=100
H=100
LeftMouseUpAction=["C:\Program Files\TencentGame\Monster Hunter Online\TCLS\client.exe"]
MouseOverAction=[!SetVariable Number "1"][!Update MeasureNumber]
MouseLeaveAction=[!DeactivateConfig "Honeycomb\mho\Wallpapers" "mho1.ini"][!DeactivateConfig "Honeycomb\mho\Wallpapers" "mho2.ini"]

[Variables]
Number=0

[MeasureNumber]
Measure=Calc
Formula=#Number#
IfCondition=(MeasureNumber=1)
IfTrueAction=[!Activateconfig "Honeycomb\mho\Wallpapers" "mho1.ini"][!SetVariable Number "2"]
IfCondition2=(MeasureNumber=2)
IfTrueAction2=[!Activateconfig "Honeycomb\mho\Wallpapers" "mho2.ini"][!SetVariable Number "1"]
and this

Code: Select all

[STEAM]
Meter=Image
ImageName=#@#Icons\mho.png
X=-12
Y=-3
W=100
H=100
LeftMouseUpAction=["C:\Program Files\TencentGame\Monster Hunter Online\TCLS\client.exe"]
MouseOverAction=[!ActivateConfig "[MeasureWallpaper]"]
MouseLeaveAction=[!DeactivateConfig "Honeycomb\mho\Wallpapers" "mho1.ini"][!DeactivateConfig "Honeycomb\mho\Wallpapers" "mho2.ini"]

[MeasureWallpaper]
Measure=Plugin
Plugin=QuotePlugin
PathName=["Honeycomb\mho\Wallpapers\"]
FileFilter=*.ini
and both aren't working. Btw I'm using skins instead of wallpapers because I have a WallpaperEngine wallpaper and I can't see the images if they are wallpapers.

TL;DR I want a skin to activate two other skins alternately when it is hovered.

Can someone tell me what I'm doing wrong or do it for me?
Thank you ^^
User avatar
balala
Rainmeter Sage
Posts: 16143
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Activate 2 skins alternately on MouseOver

Post by balala »

Your first approach is almost good, having just a few small problems:
  • Remove the MouseOverAction option of the [MHO] meter (we'll set immediately this option dynamically, through !SetOption bangs).
  • Replace the MouseLeaveAction option of the [MHO] meter with the following one: MouseLeaveAction=[!DeactivateConfig "Honeycomb\mho\Wallpapers"][!SetVariable Number "(1-#Number#)"] (also see below a detail concerned to the !DeactivateConfig bang). This way, each time you're leaving the meter, the value of the variable will change. These newly set values will be used immediately.
  • Now replace the [MeasureNumber] measure with the following one:

    Code: Select all

    [MeasureNumber]
    Measure=Calc
    Formula=#Number#
    IfCondition=(MeasureNumber=0)
    IfTrueAction=[!SetOption MHO MouseOverAction """[!Activateconfig "Honeycomb\mho\Wallpapers" "mho1.ini"]"""][!UpdateMeter "MHO"]
    IfCondition2=(MeasureNumber=1)
    IfTrueAction2=[!SetOption MHO MouseOverAction """[!Activateconfig "Honeycomb\mho\Wallpapers" "mho2.ini"]"""][!UpdateMeter "MHO"]
    DynamicVariables=1
    This measure will set dynamically the appropriate MouseOverAction option to the [MHO] meter, depending on the value of the Number variable.
Here just note that in your posted code, you've forgot to add the DynamicVariables=1 option to this measure, although you've used a dynamically set variable on the measure. It couldn't even work, without this option.
Also take care that contrary to the !ActivateConfig bang, the !DeactivateConfig doesn't need a File parameter. Eg the [!DeactivateConfig "Honeycomb\mho\Wallpapers" [color=#FF0000]"mho1.ini"[/color]] bang correctly would be [!DeactivateConfig "Honeycomb\mho\Wallpapers"]. It doesn't need the File parameter, because !DeactivateConfig always unloads the loaded file of the appropriate config, so you don't have to tell it which file should it deactivate. Definitely works even if you add the File parameter, too, but it doesn't need this parameter.
rayman13579
Posts: 2
Joined: July 15th, 2017, 8:54 pm

Re: Activate 2 skins alternately on MouseOver

Post by rayman13579 »

Thank you, it's working perfectly now. :jawdrop

But why does the

Code: Select all

IfTrueAction=[!SetOption MHO MouseOverAction """[!Activateconfig "Honeycomb\mho\Wallpapers" "mho1.ini"]"""][!UpdateMeter "MHO"]
need 3 quotationmarks?
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Activate 2 skins alternately on MouseOver

Post by jsmorley »

rayman13579 wrote:Thank you, it's working perfectly now. :jawdrop

But why does the

Code: Select all

IfTrueAction=[!SetOption MHO MouseOverAction """[!Activateconfig "Honeycomb\mho\Wallpapers" "mho1.ini"]"""][!UpdateMeter "MHO"]
need 3 quotationmarks?
Because it has quotes embedded in a parameter of the bang. You need the "quotes" around the parameter to deal with the spaces in the parameter, but the embedded quotes would confuse the hell out of it. Using Magic Quotes allows you to deal with this.