It is currently April 28th, 2024, 7:57 am

[reloaded] I am struggling with RoundLine

Get help with creating, editing & fixing problems with skins
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [reloaded] I am struggling with RoundLine

Post by jsmorley »

Mordasius wrote:I've been following this thread with interest and would like to throw a small firecracker in the air if I may. My question is why have a fixed gap between the end of night and sunrise and between sunset and the beginning of night?

These times are twilight, oft referred to as dawn and dusk, when the sun is below the horizon but there is still enough light to see. Such a lovely light that is favoured by photographers and artists alike owing to the absence of shadows. Why not make that little gap between night and day represent the twilight? Be it Civil, Nautical or Astonomical.
I'm not sure what a good source for the length of "dawn" and "twilight" is, given that they vary a bit depending on the time of year and the location.

I have a skin that I did where I guesstimate it at 30 minutes, and that is probably close and a good rough amount, but it can vary from 22-48 minutes depending on the above.
SunRiseSet_1.0.rmskin
1.jpg
Skin:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]
LocationCode=USVA0944

[MeasureTime]
Measure=Time
Format=%#I:%M:%S %p

[MeasureSun]
Measure=WebParser
URL=https://wxdata.weather.com/wxdata/weather/local/#LocationCode#
RegExp=(?siU).*<sunr>(.*)</sunr>.*<suns>(.*)</suns>
FinishAction=[!EnableMeasure Lua][!UpdateMeasure Lua][!ShowMeterGroup MyMeters]

[MeasureRise]
Measure=WebParser
URL=[MeasureSun]
StringIndex=1

[MeasureSet]
Measure=WebParser
URL=[MeasureSun]
StringIndex=2

[Lua]
Measure=Script
ScriptFile=#CURRENTPATH#SunRiseSet.lua
Disabled=1

[MeterBack]
Meter=Image
Group=MyMeters
W=350
H=85
SolidColor=47,47,47,255
Hidden=1

[MeterDayState]
Meter=String
Group=MyMeters
X=10
Y=10
FontSize=15
FontWeight=700
FontColor=255,255,255,255
AntiAlias=1
Hidden=1
Text=Good [Lua:dayStateString]
DynamicVariables=1

[MeterSunState]
Meter=String
Group=MyMeters
X=10
Y=5R
FontSize=11
FontWeight=400
FontColor=255,255,255,255
InlineSetting=Weight | 700
InlinePattern=currently (.*) at
AntiAlias=1
Hidden=1
Text=It is currently [Lua:sunStateString] at [MeasureTime]
DynamicVariables=1

[MeterChange]
Meter=String
Group=MyMeters
X=10
Y=5R
FontSize=11
FontWeight=400
FontColor=255,255,255,255
InlineSetting=Weight | 700
InlinePattern=(.*) is in
AntiAlias=1
Hidden=1
Text=[Lua:changeString][Lua:formatString]
DynamicVariables=1
SunRiseSet.lua:

Code: Select all

function Initialize()

	measureRise = SKIN:GetMeasure('MeasureRise')
	measureSet = SKIN:GetMeasure('MeasureSet')
	
end

function Update()

	inSunrise = measureRise:GetStringValue()
	inSunset = measureSet:GetStringValue()
	
	NextChange(inSunrise, inSunset)
	
	return changeString..formatString
	
end

function NextChange(inSunrise, inSunset)

	currentTime = os.date('*t')
	secondsSinceMidnight = os.time() - os.time({year=currentTime.year, month=currentTime.month, day=currentTime.day, hour=0, min=0, sec=0})
	secondsTilMidnight = os.time({year=currentTime.year, month=currentTime.month, day=currentTime.day, hour=23, min=59, sec=59}) - os.time()
	
	riseHour = string.match(inSunrise, '(.-):')
	riseMinute = string.match(inSunrise, '.-:(%d%d)')
	setHour = string.match(inSunset, '(.-):') + 12
	setMinute = string.match(inSunset, '.-:(%d%d)')
	
	if currentTime.hour >= 0 and currentTime.hour < 12 then
		dayStateString = 'Morning'
	elseif currentTime.hour >= 12 and currentTime.hour < 18 then
		dayStateString = 'Afternoon'
	else
		dayStateString = 'Evening'
	end
	
	if os.time() >= os.time({year=currentTime.year, month=currentTime.month, day=currentTime.day, hour=setHour, min=setMinute})  then
		dayState = 'SunRiseTomorrow'
	elseif os.time() <= os.time({year=currentTime.year, month=currentTime.month, day=currentTime.day, hour=riseHour, min=riseMinute}) then
		dayState = 'SunRiseToday'
	else
		dayState = 'SunSetToday'
	end
	
	if dayState == 'SunRiseTomorrow' then
		secondsTilChange = secondsTilMidnight + (riseHour * 3600) + (riseMinute * 60)
	end
	
	if dayState == 'SunRiseToday' then
		secondsTilChange = ((riseHour * 3600) + (riseMinute * 60)) - secondsSinceMidnight
	end
	
	if dayState == 'SunSetToday' then
		secondsTilChange = os.time({year=currentTime.year, month=currentTime.month, day=currentTime.day, hour=setHour, min=setMinute}) - os.time()
	end
	
	formatTable = ConvertSeconds(secondsTilChange)
	formatString = formatTable.hours..' hours '..formatTable.mins..' minutes '..formatTable.secs..' seconds'
	
	if dayState == 'SunSetToday' then
		sunStateString = 'Daytime'
		changeString = 'Sunset is in '
	else 
		sunStateString = 'Nighttime'
		changeString = 'Sunrise is in '
	end

	if os.time() >= os.time({year=currentTime.year, month=currentTime.month, day=currentTime.day, hour=riseHour, min=riseMinute}) - 1800 and os.time() <= os.time({year=currentTime.year, month=currentTime.month, day=currentTime.day, hour=riseHour, min=riseMinute}) + 1800 then
		sunStateString = 'Dawn'
	end
	
	if os.time() >= os.time({year=currentTime.year, month=currentTime.month, day=currentTime.day, hour=setHour, min=setMinute}) - 1800 and os.time() <= os.time({year=currentTime.year, month=currentTime.month, day=currentTime.day, hour=setHour, min=setMinute}) + 1800 then
		sunStateString = 'Twilight'
	end

	return formatString
	
end


function ConvertSeconds(secondsArg)
   
   local daysDiff = math.floor(secondsArg / 86400)
   local remainder = (secondsArg % 86400)
   local hoursDiff = math.floor(remainder / 3600)
   local remainder = (secondsArg % 3600)
   local minsDiff = math.floor(remainder / 60)
   local secsDiff = (remainder % 60)
   
   local elapsedTable = {days=daysDiff, hours=hoursDiff, mins=minsDiff, secs=secsDiff}   
   
   return elapsedTable
   
end
The bit that does "dawn" and "twilight":

Code: Select all

	if os.time() >= os.time({year=currentTime.year, month=currentTime.month, day=currentTime.day, hour=riseHour, min=riseMinute}) - 1800 and os.time() <= os.time({year=currentTime.year, month=currentTime.month, day=currentTime.day, hour=riseHour, min=riseMinute}) + 1800 then
		sunStateString = 'Dawn'
	end
	
	if os.time() >= os.time({year=currentTime.year, month=currentTime.month, day=currentTime.day, hour=setHour, min=setMinute}) - 1800 and os.time() <= os.time({year=currentTime.year, month=currentTime.month, day=currentTime.day, hour=setHour, min=setMinute}) + 1800 then
		sunStateString = 'Twilight'
	end
I guess this is drifting perilously close to off topic gimbal-lock ... ;-)
You do not have the required permissions to view the files attached to this post.
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: [reloaded] I am struggling with RoundLine

Post by FreeRaider »

jsmorley wrote:I'm not sure what a good source for the length of "dawn" and "twilight" is, given that they vary a bit depending on the time of year and the location.
I am using a modified moshi's skin, modified because the original url to the weather and twilight information are no longer available.

Now, I use this link
http://www.7timer.info/index.php?product=astro&lon=[i][MeasureLon][/i]&lat=[i][MeasureLat][/i]&lang=en&ac=0&unit=metric&tzshift=0&site=",
if you're interested.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: [reloaded] I am struggling with RoundLine

Post by Mor3bane »

jsmorley wrote: I guess this is drifting perilously close to off topic gimbal-lock ... ;-)
But so very helpful in view of the intended USE of the Roundline idea...
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: [reloaded] I am struggling with RoundLine

Post by Mor3bane »

Mordasius wrote:I've been following this thread with interest ...
How circumstantial you showed up Mordasius :)

I will just go with the flow then, as I have further questions and need for help with the skin I have been building.

I attached the current iteration below.

In the skin "Circle Cycle" I am trying to figure out how to make the sun travel across the circumference of my skin, and within the bounds of the Roundlines, according to the hour of the day - similar to the hand of a clock, but with an image of the sun that is in the rmskin.
Mor3bane wrote: At this stage, I think I am overcomplicating it, but I can't figure out, with the borrowed code I have been utilising, how to achieve my goal.
EDIT: I have realised that a simple Rotator can do the job. Funnily enough I don't think I am getting the StartAngle and RotationAngle right, nor do I feel I am doing the ValueRaminder correctly either.
I hope my question/explanation makes sense...
Circle Cycle_1.3.rmskin
You do not have the required permissions to view the files attached to this post.
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: [reloaded] I am struggling with RoundLine

Post by Mordasius »

Mor3bane wrote:Circle Cycle_1.3.rmskin
We seem to have lost the .rmskin - nope it's back again.....

P.S. You may find the TimeDate skin in the Dieselpunk HUD collection (https://www.deviantart.com/mordasius/art/Steel-plates-with-pipes-Rainmeter-Dieselpunk-HUD-551616304) has some of the things you need. It uses a Lua script that needs your latitude and longitude to get the sun times but I'll see if I can edit it to fit in with your skin.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: [reloaded] I am struggling with RoundLine

Post by Mor3bane »

Hi, I added this bit to the end. The comment marks the spot from which everything below it was replaced with this Rotator meter.

I am a bit messed up on how to get the sun to rotate according to the 24 hour clock, rather than the 12 hour clock.
I tried to make the ValueRemainder=86400 and use the included [MeasureTime24] as the Rotator's Measure, but that didn't look right.

It seems all I got right is the sun image centered properly to appear within the bounds of the Roundlines - visually that is.
Here is the code:

Code: Select all

;===== MeasureSunPosition =========;

[MeasureTimeSun]
Measure=Time

[MeasureTime24]
Measure=Time
Format=%H

[MeterHourSun]
Meter=Rotator
Measurename=MeasureTimeSun
Imagename=#@#Sun.png
X=19
Y=17
W=222
H=222
StartAngle=3.1416
RotationAngle=6.2832
Valueremainder=43200
Offsetx=111
Offsety=111
Antialias=1
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: [reloaded] I am struggling with RoundLine

Post by Mor3bane »

Mor3bane wrote:Hi, I added this bit to the end. The comment marks the spot from which everything below it was replaced with this Rotator meter.

I am a bit messed up on how to get the sun to rotate according to the 24 hour clock, rather than the 12 hour clock.
I tried to make the ValueRemainder=86400 and use the included [MeasureTime24] as the Rotator's Measure, but that didn't look right.

It seems all I got right is the sun image centered properly to appear within the bounds of the Roundlines - visually that is.
Here is the code:

Code: Select all

;===== MeasureSunPosition =========;

[MeasureTimeSun]
Measure=Time

[MeasureTime24]
Measure=Time
Format=%H

[MeterHourSun]
Meter=Rotator
Measurename=MeasureTimeSun
Imagename=#@#Sun.png
X=19
Y=17
W=222
H=222
StartAngle=3.1416
RotationAngle=6.2832
Valueremainder=43200
Offsetx=111
Offsety=111
Antialias=1
Ok... I think this got it :oops:

Code: Select all

;===== MeasureSunPosition =========;

[MeasureTimeSun]
Measure=Time

[MeterHourSun]
Meter=Rotator
Measurename=MeasureTimeSun
Imagename=#@#Sun.png
X=19
Y=17
W=222
H=222
StartAngle=1.5708
RotationAngle=6.2832
Valueremainder=86400
Offsetx=111
Offsety=111
Antialias=1
Mor3bane wrote: To the MOON Alice! To the MOON!
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: [reloaded] I am struggling with RoundLine

Post by Mordasius »

The attached .rmskin file uses the Lua script I mentioned above.
You do not have the required permissions to view the files attached to this post.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: [reloaded] I am struggling with RoundLine

Post by Mor3bane »

Mordasius wrote:The attached .rmskin file uses the Lua script I mentioned above.
That. Is. Really. Awesome!
By the way - it was just the name of the image :P
I changed the twilight color to a dusky blue as well since that is pretty much all I could understand :lol:

I am just kind of inventing what this skin is gonna look like but I do want to do more to it. The lua is way too advanced but the reliability of the versatility is undeniably worth keeping, and building on - literally just tacking my junk on top of all of that awesome code :sly:
Untitled.jpg
You do not have the required permissions to view the files attached to this post.
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
Mordasius
Posts: 1173
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: [reloaded] I am struggling with RoundLine

Post by Mordasius »

Ahha.. That's looking good. Now I see what the [MeterDivisions] is supposed to look like. Might I suggest that that [MeterDivisions] changes colour and starts rotating anti-clockwise during the twilight hours?