It is currently April 25th, 2024, 11:44 am

Section Location Reference

Get help with creating, editing & fixing problems with skins
User avatar
AveryNightshade
Posts: 8
Joined: October 11th, 2022, 2:27 pm
Location: Australia

Section Location Reference

Post by AveryNightshade »

Pretty basic question sorry!

Just trying to make my skin dependent on the variables.inc, but I'm getting the location/layout wrong in my code?
Is it the [], the ##, \\, etc? Not many of the skins I've downloaded seem to make the skins dependent so I can't use them as references. Log doesn't turn up with anything.

Code!
Messy!
Apologies!

Code: Select all

[Variables]
Format=#I
@include=#@#Variables.inc
UpdateInSeconds=120

[MeterQuote]
Meter=String
StringAlign=#@#Variables.inc\[TecSettings]\#StringAlignQuote#
FontColor=#@#Variables.inc\[TecSettings]\#ColorSpeech#
FontFace=#@#Variables.inc\[TecSettings]\#FontSpeech#
FontSize=#@#Variables.inc\[TecSettings]\#FontSizeQuote#
X=#@#Variables.inc\[TecSettings]\#SpeechX#
Y=#@#Variables.inc\[TecSettings]\#SpeechY#
W=#@#Variables.inc\[TecSettings]\#QuoteW#
Text=#Speech#\"%1"
AntiAlias=1
ClipString=2

and for the Variables.inc in case it is that which is messed up and I'm trying to do something that can't be done:

Code: Select all

[TecSettings]
ColorSpeech=28,161,82,255
ColorName=0,0,0,255

FontSizeSpeech=16
FontSizeQuote=16
FontSizeAuthor=16
FontSizeName=20

NameX=290
NameY=240
RefreshX=1000R
RefreshY=100
SpeechX=0
SpeechY=0
QuoteW=1000
AuthorX=1000
AuthorY=0R

FontSpeech=Mandatory Plaything
FontNametag=Robot 9000

StringAlignRefresh=Right
StringAlignName=Left
StringAlignQuote=Left
StringAlignAuthor=Right

CharacterW=600
BoxSize=9

NametagName=Demo
QuoteNext=Next Message >

WindowCharacterPosX=50%@2
WindowCharacterPosY=39.8%@2
WindowSpeechPosX=17%@2
WindowSpeechPosY=78%@2
WindowBoxPosX=15%@2
WindowBoxPosY=99%@2
WindowNamePosX=3.8%@2
WindowNamePosY=45.5%@2
User avatar
Brian
Developer
Posts: 2681
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Section Location Reference

Post by Brian »

With @Include files, once defined in the skin, there is no need to directly reference the @Include in your options. Also, it is good practice to place the @Include definition at the end of a section instead of inbetween options.
https://docs.rainmeter.net/manual/skins/include-option/

Inside your @Include file, you want variables in their own [Variables] section, not a section like [TecSettings].


So, try this:

Code: Select all

[Variables]
Format=#I
UpdateInSeconds=120

@include=#@#Variables.inc

[MeterQuote]
Meter=String
StringAlign=#StringAlignQuote#
FontColor=#ColorSpeech#
FontFace=#FontSpeech#
FontSize=#FontSizeQuote#
X=#SpeechX#
Y=#SpeechY#
W=#QuoteW#
Text=#Speech#\"%1"
AntiAlias=1
ClipString=2
I am not sure about your [MeterQuote] Text option, since I cannot see any variables named #Speech#, but maybe that is in another part of your code. Also, there is no MeasureName option, so %1 will not resolve to anything, but the literal text "%1".

.inc file:

Code: Select all

[Variables]
ColorSpeech=28,161,82,255
ColorName=0,0,0,255

FontSizeSpeech=16
FontSizeQuote=16
FontSizeAuthor=16
FontSizeName=20

NameX=290
NameY=240
RefreshX=1000R
RefreshY=100
SpeechX=0
SpeechY=0
QuoteW=1000
AuthorX=1000
AuthorY=0R

FontSpeech=Mandatory Plaything
FontNametag=Robot 9000

StringAlignRefresh=Right
StringAlignName=Left
StringAlignQuote=Left
StringAlignAuthor=Right

CharacterW=600
BoxSize=9

NametagName=Demo
QuoteNext=Next Message >

WindowCharacterPosX=50%@2
WindowCharacterPosY=39.8%@2
WindowSpeechPosX=17%@2
WindowSpeechPosY=78%@2
WindowBoxPosX=15%@2
WindowBoxPosY=99%@2
WindowNamePosX=3.8%@2
WindowNamePosY=45.5%@2
Hopefully that helps.

-Brian
User avatar
AveryNightshade
Posts: 8
Joined: October 11th, 2022, 2:27 pm
Location: Australia

Re: Section Location Reference

Post by AveryNightshade »

Works! Thanks for your assistance Brian!
Brian wrote: January 27th, 2023, 7:14 am I am not sure about your [MeterQuote] Text option, since I cannot see any variables named #Speech#
Not sure how that got in there, but thanks for pointing it out!
Just want some clarification however:
Brian wrote: January 27th, 2023, 7:14 am Inside your @Include file, you want variables in their own [Variables] section, not a section like [TecSettings].
So I'm not able to use only certain sections of the code in my variables, for example, if I had a different section in the same variables.inc. Keep them in separate .inc files?
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Section Location Reference

Post by balala »

AveryNightshade wrote: January 27th, 2023, 9:38 am So I'm not able to use only certain sections of the code in my variables, for example, if I had a different section in the same variables.inc. Keep them in separate .inc files?
Not sure I fully understand your question, but what Brian meant is that the variables (ColorSpeech, ColorName, FontSizeSpeech, FontSizeQuote, FontSizeAuthor, FontSizeName and so on) are added to a section named [TecSettings] (posted by you into the Spoiler of your original message). With such a section name, those variables are not used by the skin. If those are indeed variables (and they are, based on the posted code) the section name where they are (no matter if that section is in the skins .ini file or into an included file) has to be [Variables]. So you have to replace the [TecSettings] section name in the @Resources\Variables.inc file, by [Variables].
User avatar
Brian
Developer
Posts: 2681
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Section Location Reference

Post by Brian »

AveryNightshade wrote: January 27th, 2023, 9:38 am So I'm not able to use only certain sections of the code in my variables, for example, if I had a different section in the same variables.inc. Keep them in separate .inc files?
If I am understanding your question correctly, you are asking if you can use different sections within an @Include file? The answer is yes! You just want variables in a section called [Variables] (just like a regular skin).

Think of @include files as an extension of the skin. The code is the same. There is no special way to refer to any variable or section (measure, meter, or meter style) when used in the main skin, or in the @include file. When the skin is read and encounters the @Include option, it immediately opens the @Include file, and reads its contents. This part is important to understand because the order of measures and meters can be important.

So any variables you want to define, need to be a section called [Variables] regardless of which file they are defined (also, each @Include file can have their own [Variables] section, just note that in case of duplicated variables, the first defined variable in order of being read is considered the "real" variable). You can also place measures, meters, and meter styles in @Include files if you want - but you refer to those items just same as you would if they were all defined in the skin itself.

You can use @Include to group similar variables or sections used in separate skins to cut down on repetitive code. It can also help organize bits of code that pertain to one another, so you don't have to hunt around your main skin code to find them. For example, a spectrum analyzer skin might put all the variables and AudioLevel measures in an @Include file to keep all the similar stuff in one place.

Hopefully that all makes sense.

Here is a helpful guide on @Include files: https://docs.rainmeter.net/tips/include-guide/

-Brian
User avatar
AveryNightshade
Posts: 8
Joined: October 11th, 2022, 2:27 pm
Location: Australia

Re: Section Location Reference

Post by AveryNightshade »

Got it! Thanks Brian and balala!

For the people coming across this thread now:
I was just after whether I was able to condense multiple .inc files into the one @include file under different section names but the sections that are included in @include have to have the [Variables] section to work, therefore the multiple .inc files are required.