It is currently April 25th, 2024, 5:05 pm

Trying to combine image changing and analog clock

Get help with creating, editing & fixing problems with skins
MissingNumbers
Posts: 4
Joined: April 11th, 2018, 6:15 am

Trying to combine image changing and analog clock

Post by MissingNumbers »

Hello, brand new user fresh off the presses and trying to get into making a skin. What I'm trying to make is an analog clock that changes its face depending on the time of day. To be more specific, a sun from 6 AM onward, and a moon from 6 PM onward. Yet no matter what I've tried, the hands don't move and often I can't get the face to change. Are these two features even compatible with each other?
User avatar
deXxterlab97
Posts: 93
Joined: February 5th, 2017, 4:50 am

Re: Trying to combine image changing and analog clock

Post by deXxterlab97 »

what's your code?
deXxterlab97
MissingNumbers
Posts: 4
Joined: April 11th, 2018, 6:15 am

Re: Trying to combine image changing and analog clock

Post by MissingNumbers »

deXxterlab97 wrote:what's your code?
I've been modifying the Deluxe Analog Clock by Güntmeister and trying to combine it with various tips on changing images based on time. This is what I have so far, but it just results in only the hands appearing, with them locked at 12.

Code: Select all

Update=1000

[MeasureTime]
Measure=Time

[Clock]
Meter=IMAGE
ImageName=images\okami_sun.png
X=1
Y=1
W=130	
H=130

[MeasureHours]
Measure=Time
Format=%H
IfCondition=(MeasureHours . 6) && (MeasureHours < 18)
IfTrueAction=[!SetOption Clock ImageName  "#@#okami_moon.png"] [!Update]
IfFalseAction=[!SetOption Clock ImageName  "#@#okami_sun.png"] [!Update]

[Hours]
Meter=Rotator
MeterStyle=Seconds
X=0
Y=0
W=130
H=130
ImageName=images\okami_h.png
StartAngle=6.2831853
RotationAngle=6.2831853
ValueReminder=43200
OffsetX=64
OffsetY=65

[Minutes]
Meter=Rotator
MeterStyle=Seconds
X=0
Y=0
W=130
H=130
ImageName=images\okami_m.png
StartAngle=6.2831853
RotationAngle=6.2831853
ValueReminder=3600
OffsetX=64
OffsetY=65
User avatar
balala
Rainmeter Sage
Posts: 16169
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Trying to combine image changing and analog clock

Post by balala »

MissingNumbers wrote:I've been modifying the Deluxe Analog Clock by Güntmeister and trying to combine it with various tips on changing images based on time. This is what I have so far, but it just results in only the hands appearing, with them locked at 12.
Beside dvo's code, here are the problems of your code:
  • The Update=1000 is an orphan option. Probably skipped to copy the [Rainmeter] section name, but take care to have it there (anyway, even if it's not, the skin works the same way, because if you don't put it explicitly there, the default value is used and this one is exactly 1000).
  • If the clock face isn't visible, check to see if you have a folder named images, next to the skin's ini file. Into this folder you should have to have an okami_sun.png image. If it's there, I can assure you it appears on the skin.
  • The [Seconds] section is missing. This section is used by the MeterStyle options of both the [Hours] and [Minutes] meters (however the skin works, even if it's not present).
  • The IfCondition option of the [MeasureHours] measure is a bit wrong. Replace the dot in the first condition with a > sign, so replace this IfCondition=(MeasureHours [color=#FF0000].[/color] 6) && (MeasureHours < 18) with this: IfCondition=(MeasureHours [color=#009900]>[/color] 6) && (MeasureHours < 18).
  • The reason why the hands don't move is that a MeasureName=MeasureTime option is missing on both meters, [Hours] and [Minutes]. Add them.
  • Although practically this isn't an issue, I'd replace the Format option of the [MeasureHours] measure with Format=%#H. With the original option if the hour is less then 10 (so it has one single digit), the measure adds a 0 before it. Replacing it with the above option avoids this.
Please let me know if these fixes your skin.
MissingNumbers
Posts: 4
Joined: April 11th, 2018, 6:15 am

Re: Trying to combine image changing and analog clock

Post by MissingNumbers »

balala wrote:Please let me know if these fixes your skin.
Finally got it sorted out. On top of various fixes you clarified (although some of them were actually just typos on my part when it came to posting it over here), it turns out I was actually mixing up two copies of the same .ini file, which was getting various variables confused. But it works now, so thanks for the help.
User avatar
balala
Rainmeter Sage
Posts: 16169
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Trying to combine image changing and analog clock

Post by balala »

Glad to help.
MissingNumbers
Posts: 4
Joined: April 11th, 2018, 6:15 am

Re: Trying to combine image changing and analog clock

Post by MissingNumbers »

Okay, actually, the clock is working as I hoped, but unfortunately, I still can't seem to get the actual image to update. While the sun image does disappear, the moon image doesn't replace it, despite it being in the same location. I've included the code as it is so far.

Code: Select all

[Rainmeter]
Author=MissingNumbers, base code by Güntmeister
Update=1000

[MeasureTime]
Measure=Time

[MeasureHours]
Measure=Time
Format=%#H
IfCondition=(MeasureHours > 6) && (MeasureHours < 17)
IfTrueAction=[!SetOption Clock ImageName  "#@#okami_moon.png"] [!Update]
IfFalseAction=[!SetOption Clock ImageName  "#@#okami_sun.png"] [!Update]

[Clock]
Meter=IMAGE
ImageName=images\okami_sun.png
X=1
Y=1
W=130
H=130

[Hours]
Meter=Rotator
MeterStyle=Seconds
MeasureName=MeasureTime
X=0
Y=0
W=130
H=130
ImageName=images\okami_h.png
StartAngle=6.2831853
RotationAngle=6.2831853
ValueReminder=43200
OffsetX=64
OffsetY=65

[Minutes]
Meter=Rotator
MeterStyle=Seconds
MeasureName=MeasureTime
X=0
Y=0
W=130
H=130
ImageName=images\okami_m.png
StartAngle=6.2831853
RotationAngle=6.2831853
ValueReminder=3600
OffsetX=64
OffsetY=65

[Seconds]
Meter=Rotator
MeterStyle=Seconds
MeasureName=MeasureTime
X=0
Y=0
W=130
H=130
ImageName=images\okami_s.png
StartAngle=6.2831853
RotationAngle=6.2831853
ValueReminder=60
OffsetX=64
OffsetY=65
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Trying to combine image changing and analog clock

Post by eclectic-tech »

You are using different paths for your images in your condition statement; all other images are in a sub-folder "images", but you coded "#@#images" ("@Resources\images") in the condition statements.

The logic for sun/moon backgrounds is reversed... change [MeasureHours] to this and it will work, if all your images are in the "images" folder.

Code: Select all

[MeasureHours]
Measure=Time
Format=%#H
IfCondition=(MeasureHours > 6) && (MeasureHours < 17)
IfTrueAction=[!SetOption Clock ImageName  "images\okami_sun.png"] [!Update]
IfFalseAction=[!SetOption Clock ImageName  "images\okami_moon.png"] [!Update]
:welcome: