It is currently April 26th, 2024, 5:57 pm

Auto-centering a skin when it changes form?

Get help with creating, editing & fixing problems with skins
SebHolm91
Posts: 6
Joined: October 20th, 2014, 7:52 am

Auto-centering a skin when it changes form?

Post by SebHolm91 »

Hey guys, I just registered because I've been trying my skills in changing some skin code and now I'm stuck (noob at programming). I found this awesome minimalistic text clock skin that writes out the words and I'd like to have the text centered no matter which words are being used. I have no idea how and I couldn't find anything with Google.

I've attached a screenshot of my work in progress and as you may see the time is sort of centered but because it's a short description at the time of the screenshot, it ends before it reaches the right side of the center... it's difficult to actually put into words but I hope the picture makes it easier >.>'

Thanks in advance ^_^
You do not have the required permissions to view the files attached to this post.
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Auto-centering a skin when it changes form?

Post by Mordasius »

The screenshot doesn't really make it any easier to help without seeing the code in your .ini file, but you might like to take a look at StringAlign in the online manual.
SebHolm91
Posts: 6
Joined: October 20th, 2014, 7:52 am

Re: Auto-centering a skin when it changes form?

Post by SebHolm91 »

Well I didn't make the skin myself so I'm not that well into the .ini, but I can paste it for you here:

Code: Select all

[Rainmeter]
Author=Jlynn @ WWW.neon-ink.TK
Update=500
 Group=Config

[Metadata]
Name=Timext
Version=1.0
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0

[Variables]
@Include=#ROOTCONFIGPATH#@Resources\Variables.inc

[MeterBackground]
W=200
H=100
X=(#SCREENAREAWIDTH#/2)-100
Y=(#SCREENAREAHEIGHT#/2)-50

[MeasureTimeH]
Measure=Time
Format=%#H

[MeasureTimeM]
Measure=Time
Format=%M

[Clock]
Meter=String
MeasureName=MeasureClock
MeterStyle=Text
StringAlign=Center
X= (#WIDTH#-(#HEIGHT#/2-#FONTSIZE#*0.8))

[Hours]
MeasureName=MeasureTimeH
SolidColor=0,0,0,0
Meter=Image
ImageName=#ROOTCONFIGPATH#@Resources\Hours\%1.png
ImageTint=#Color#,255
ClipString=0
X=(0*#size#/100)
Y=(50*#size#/100)
W=(628*#size#/100)
H=(78*#size#/100)

[Minutes]
MeasureName=MeasureTimeM
SolidColor=0,0,0,0
Meter=Image
ImageName=#ROOTCONFIGPATH#@Resources\Mins\%1.png
ImageTint=#Color2#,255
ClipString=1
X=(635*#size#/100)
Y=(50*#size#/100)
H=(78*#size#/100)
W=(661*#size#/100)
I tried making the skin center on the screen and it seems to have worked - that's the Meter Background in the top of the code. I also have another screenshot below showing the time being sort of adjusted in the center of the screen if you look at it as starting on the left side of the center. Problem is though that the lenght of the text means that is looks assymetrical at this specific time of day while other combinations will fill out the entire line so that it looks slightly more aesthetic. I don't know if I'm making any sense here, maybe the photo helps:
You do not have the required permissions to view the files attached to this post.
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Auto-centering a skin when it changes form?

Post by Mordasius »

It's difficult to tell what is going on here without seeing what values do you have for #WIDTH#, #HEIGHT#, #FONTSIZE# and #size# in #ROOTCONFIGPATH#@Resources\Variables.inc How about the lines in MeasureClock and MeterStyle=Text? Are all the images in #ROOTCONFIGPATH#@Resources\Mins and #ROOTCONFIGPATH#@Resources\Hrs exactly the same size?

Best to just post a link to the original skin or let us see what is in Variables.inc

P.S. don't bother giving us a link to the online dating site referenced by the skin's Author!
SebHolm91
Posts: 6
Joined: October 20th, 2014, 7:52 am

Re: Auto-centering a skin when it changes form?

Post by SebHolm91 »

Well the original version can be found here and it should pretty much be the same as the slightly modified version I pasted above. As for the variables I'm not sure if this is what you mean, it almost seems like too little:

Code: Select all

[Variables]
Color=23,23,23
Color2=247,247,247
Size=70
I'm sorry if I'm being difficult, it's just that I'm not very experienced in actually coding, I mostly just reorganize skins and modify them slightly >. >'
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Auto-centering a skin when it changes form?

Post by Mordasius »

Sorry, but I really can't be bothered to help with skins that come from DA pages with links to sites like neon-inks.net that may be soaked with adverts or otherwise look a little suspect.
Last edited by Mordasius on October 20th, 2014, 3:16 pm, edited 1 time in total.
SebHolm91
Posts: 6
Joined: October 20th, 2014, 7:52 am

Re: Auto-centering a skin when it changes form?

Post by SebHolm91 »

Oh ok then, I have to admit that I never visited Neon, but then what about any code that would re-center the skin every time it updates?
Ricowan
Posts: 5
Joined: October 18th, 2014, 11:36 pm

Re: Auto-centering a skin when it changes form?

Post by Ricowan »

You appear to be assuming that the width of the two meters in this skin added together are 200 pixels wide: X=(#SCREENAREAWIDTH#/2)-100

What you need to use instead of 100 is (1290*#size#/100).
X=(#SCREENAREAWIDTH#/2)-(1290*#size#/100)

Each hour image is 628 pixels wide, and each minute image is 661 pixels. Adding them together gets 1282, and it looks like there's an 8 pixel spacer so 1290 total.
SebHolm91
Posts: 6
Joined: October 20th, 2014, 7:52 am

Re: Auto-centering a skin when it changes form?

Post by SebHolm91 »

That makes perfect sense now that you mention it, I didn't at all think of measuring it up like that but I suppose I'll try and remember this for future use - I've updated the skin now with the new number, so I hope that it'll work.

Thanks a lot for helping me out! :)
Ricowan
Posts: 5
Joined: October 18th, 2014, 11:36 pm

Re: Auto-centering a skin when it changes form?

Post by Ricowan »

Oops, I forgot to divide that new value by two, hope you caught that. :)