It is currently May 3rd, 2024, 6:59 pm

Sunsetting Skin

Get help with creating, editing & fixing problems with skins
Canayon9
Posts: 10
Joined: September 3rd, 2012, 12:55 pm

Sunsetting Skin

Post by Canayon9 »

Im trying to make this really simple skin that makes a picture of a sun go up and down based on the time of day. For some reason its not plotting the sun. Help please. Here's my code:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeasureTime]
Measure=Time
Format="%#H"

[MeasureSunHeight]
Measure=Calc
Formula=MeasureTime < 6 ? 0 : MeasureTime > 19 ? 0 : MeasureTime > 12 ? 24-MeasureTime

[MeterImage]
MeasureName=MeasureSunHeight
Meter=Image
ImageName=sun.png
w=350
h=350
X=1050
Y=((#SCREENAREAHEIGHT#-500)*[MeasureSunHeight])
DynamicVariables=1
User avatar
wiedzmawiedzma
Posts: 112
Joined: August 18th, 2012, 5:19 pm

Re: Sunsetting Skin

Post by wiedzmawiedzma »

Canayon9
Posts: 10
Joined: September 3rd, 2012, 12:55 pm

Re: Sunsetting Skin

Post by Canayon9 »

Im trying to do it differently, I'm pretty certain its right but it just keeps on plotting the sun at #SCREENAREAHEIGHT#-500 and disregards the rest.
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: Sunsetting Skin

Post by MerlinTheRed »

Have you tried adding parentheses in that formula? I'm not sure what priority exactly this if-then-else operator has, so I'd better bracket them just to be sure.
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Sunsetting Skin

Post by jsmorley »

MerlinTheRed wrote:Have you tried adding parentheses in that formula? I'm not sure what priority exactly this if-then-else operator has, so I'd better bracket them just to be sure.
Merlin is right, take a look at the parentheses in this example:

Code: Select all

[MeasureOne]
Measure=Calc
Formula=2

[MeasureTwo]
Measure=Calc
Formula=(MeasureOne < 1) ? 99 : ((MeasureOne < 2) ? 98 : ((MeasureOne < 3) ? 97 : 96))
This measure would return 97. Since the first statement of MeasureOne < 1 is false, the formula begins testing the nested formulas in order until the condition becomes true . If none of the conditions are met, the final false value of 96 would be set.
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Sunsetting Skin

Post by Kaelri »

You're also missing an "else" condition at the very end of your formula:

Code: Select all

Formula=MeasureTime < 6 ? 0 : (MeasureTime > 19 ? 0 : (MeasureTime > 12 ? (24-MeasureTime) ) )
This says "if (MeasureTime > 12), do (24-MeasureTime)." But you also need to provide a value for when (MeasureTime > 12) is not true.

Code: Select all

Formula=MeasureTime < 6 ? 0 : (MeasureTime > 19 ? 0 : (MeasureTime > 12 ? (24-MeasureTime) : ??? ) )
Canayon9
Posts: 10
Joined: September 3rd, 2012, 12:55 pm

Re: Sunsetting Skin

Post by Canayon9 »

It's still not working...
User avatar
MerlinTheRed
Rainmeter Sage
Posts: 889
Joined: September 6th, 2011, 6:34 am

Re: Sunsetting Skin

Post by MerlinTheRed »

You might want to look at this post. It does something similar to what you seem to want.

http://rainmeter.net/forum/viewtopic.php?p=76101#p76101
Have more fun creating skins with Sublime Text 2 and the Rainmeter Package!
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Sunsetting Skin

Post by Kaelri »

It would also help if you could describe a) how it's not working, and b) what code you're using now.
Canayon9
Posts: 10
Joined: September 3rd, 2012, 12:55 pm

Re: Sunsetting Skin

Post by Canayon9 »

This is my current code. I have it at #SCREENAREAHEIGHT#-500 because that's where the horizon is. It's not working because all it will do is plot at #SCREENAREAHEIGHT#-500. I think its disregarding the rest of the formula because the MeasureSunHeight value isnt being carried over?

[Rainmeter]
Author=Canayon
Update=1000
DynamicWindowSize=1

[MeasureTime]
Measure=Time
Format="%#H"


[MeasureSunHeight]
Measure=Calc
Formula= MeasureTime < 6 ? 0 : (MeasureTime > 19 ? 0 : (MeasureTime > 12 ? (24-MeasureTime) : MeasureTime) )

[Plot]
Meter=Image
ImageName=sun.png
w=350
h=350
X=1050
Y=(#SCREENAREAHEIGHT#-500)+([MeasureSunHeight]*70)
DynamicVariables=1