This trick simplifies the way you make your skins allowing to quickly edit, update, scale, and fix without copy/pasting the same code and chaning an incremental value over all the meters.
(There is another approach if you need to create similar looking set of meters and measures on the go using the template generation method.)
This trick is good for somewhat complex skins, which I call component based – you already have your various repetative meters where the difference is only a number (also possible with words or letters, depending on your case, but using numbers allow more flexibility), and you just keep 100% of everything else in the correspodning MeterStyles.
This method deals with cases like:
Code: Select all
[Meter1]
Meter=Image
[Meter2]
Meter=Image
[AnotherMeter1]
Meter=String
X=[Meter1:X]
DynamicVariables=1
[AnotherMeter2]
Meter=String
X=[Meter2:X]
DynamicVariables=1
And it also works with stuff like:
Code: Select all
[Text1]
Meter=String
[Text2]
Meter=String
[Image1]
Meter=Image
X=[Text1:X]
DynamicVariables=1
[Image2]
Meter=Image
X=[Text2:X]
DynamicVariables=1
It is good to remind again that while I provide simplistic examples where any tricks are not very necessary, this simplification method is good for more complex structures where you really want to to use MeterStyles by 100% to simplify your coding process and make everything consistent.
How it works:
– By using Variables and Nested Variables we can omit any part of the section name enclosed in varibles.
– The section names above will be called as [#Meter#1] and [#Meter#2].
– When we use nested format of the built-in variable [#CURRENTSECTION] we will retrive the section names as #Meter#1 and #Meter#2.
– But if we already have established #Meter# variable in [Variables] section and set it to have nothing (Meter=), by calling [#CURRENTSECTION] we will be left with the current section index, which is just the number 1, 2, etc.
– So, we left only with including a desired meter category using Nested Variables, like [#*SomeMeter*#[#CURRENTSECTION]]. By enclosing SomeMeter in asterisk signs we tell it not to be changed because in Variables we have already established the variable to be substituted with nothing. If you need to refer to such meter in general you would need to do this using [#*SomeMeter*#index] form.
– If you really don't want to include a desired category name and want strictly to use current section then you just simply use #CURRENTSECTION#, but if you refer to another meter within the same index domain then you need to use Nested Variable like explained before.
Example:
Code: Select all
[Variables]
Text=
Image=
[#Text#1]
Meter=String
[#Text#2]
Meter=String
[StyleMyimage]
X=([#*Text*#[#CURRENTSECTION]:X])
[#Image#1]
Meter=Image
MeterStyle=StyleMyimage
[#Image#2]
Meter=Image
MeterStyle=StyleMyimage
Example skin: Code:
I am open to any questions regarding further simplification that you are interested in.
I will be also adding more cases when I encounter them.