This is a method that I'm using to make skins cycle between several different forms on command. If you have a skin with many separate variants, each of which shares the same basic meters and only differs in appearance, this will enable you to condense them into a single self-modifying skin.
This method allowed me to eliminate over 40 .ini files - more than a third of my suite - without removing any functionality whatsoever.
First, decide how many variations you want in your cycle, and give them each a unique name in your
[Variables] section.
Code: Select all
[Variables]
Style1=Alpha
Style2=Beta
Style3=Gamma
Second, create a MeterStyle for each variation. These styles will determine how a particular meter appears as you rotate the skin. Make sure that the exact variation name is included in the name of each style, and that the rest of the name stays constant.
Code: Select all
[StyleTextAlpha]
FontColor=0,0,0
StringAlign=LEFT
[StyleTextBeta]
FontColor=255,255,255
StringAlign=CENTER
[StyleTextGamma]
FontColor=160,160,160
StringAlign=RIGHT
You'll need to repeat this for each meter that needs to be changed. For example, if you have three variations and three meters to vary, you'll need nine styles (unless several meters can use the same styles).
Third, tell your meters to use the first style, using the variable that you created.
Code: Select all
[MeterText]
Meter=STRING
MeterStyle=StyleText#Style1#
Fourth, create a command that will cause the variables to rotate. I like to apply a MiddleMouseDown action to the skin as a whole:
Code: Select all
[Rainmeter]
MiddleMouseDownAction=!Execute [!RainmeterWriteKeyValue Variables Style1 #Style2#][!RainmeterWriteKeyValue Variables Style2 #Style3#][!RainmeterWriteKeyValue Variables Style3 #Style1#][!RainmeterRefresh]
The skin will now instantly rotate to the next variation when clicked. Because the command uses
!RainmeterWriteKeyValue, the active variation will persist even if the skin (or Rainmeter) is closed.
There is no limit to the number of different variations you can use, nor to the number of meters changed, as long as you provide the necessary MeterStyles. If you have a meter that you don't want to appear in some phases, such as an icon or a background image, you can simply tell it to hide:
Code: Select all
[StyleImageAlpha]
Hidden=1
X=0
Y=0
W=0
H=0
Finally, if you have a number of skins using exactly the same set of styles, you can add them to a shared
.inc file. This will not only allow you to edit the appearance of many different skins at once, but also reduce the size of your package by eliminating redundant code. If your skins are sufficiently uniform, it is possible to write working meter sections with only three keys (type, measure and style).
Code: Select all
@include=#SKINSPATH#YourSkinName\SharedStyles.inc