It is currently March 29th, 2024, 10:17 am

Wind Speed and Direction V1.1.0 Updated

Weather skins
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Wind Speed and Direction V1.1.0 Updated

Post by CyberTheWorm »

jminternelia wrote:Muchos Gracias.
New version should say 4.0 now
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
jminternelia
Posts: 65
Joined: March 21st, 2017, 3:46 am

Re: Wind Speed and Direction V1.1.0 Updated

Post by jminternelia »

CyberTheWorm wrote:Will work fine in 4.0, I was testing 4.1 and forgot to change the version number. Will re-upload it
Ok, I'm gonna go for noob, but I am trying to reconfigure this with some alternate assets, and I can't figure it out.

My arrow is wayyy too big. It is worth noting that the W and H for the compass are set to the size I want in the code. I tried this on the arrow also but has no effect on the arrow. Even still, before I changed W and H, I could get the (new) arrow lined up perfect in one in instance. I created a calc measure to change the direction parameter to test and quickly realized something about my arrows axis is off.

What I am trying to do:
Image
What I have:
Image
Code:

Code: Select all

[Rainmeter]
Update=1000
DynamicVariables=1
DynamicWindowSize=1
ContextTitle=Use Imperial
ContextAction=[!WriteKeyValue Variables UnitOfMeasure i][!Refresh]
ContextTitle2=Use Metric
ContextAction2=[!WriteKeyValue Variables UnitOfMeasure m][!Refresh]

[Metadata]
Author=CyberTheWorm
Version=1.1.0
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Information=Wind Speed Direction

;-------------------- Variables ----------------------
[Variables]
; LocationCode can be obtained at http://wxdata.weather.com/wxdata/search/search?where=YourCityName
LocationCode=CAXX0485
; UnitOfMeasure can be "i" (Imperial / Fahrenheit) or "m" (Metric / Celsius)
UnitOfMeasure=m

; Locale (language) to use in the feed.
; https://msdn.microsoft.com/en-us/goglobal/bb896001.aspx
; Note that Weather.com uses "_" underline instead of "-" dash in the codes.
Locale=en_US

WebSite=https://wxdata.weather.com/wxdata/weather/local/#LocationCode#?cc=*&unit=#UnitOfMeasure#&dayf=1&locale=#Locale#

;-------------------- Measures ----------------------

[MeasureValues]
Measure=Plugin
Plugin=WebParser
URL=#WebSite#
RegExp=(?siU)<us>(.*)</us>.*<s>(.*)</s>.*<d>(.*)</d>
;Update every 15 mins
UpdateRate=900

[MeasureSpeedUnit]
Measure=Plugin
Plugin=WebParser
URL=[MeasureValues]
StringIndex=1

[MeasureWindSpeed]
Measure=Plugin
Plugin=WebParser
URL=[MeasureValues]
StringIndex=2

[MeasureDirection]
Measure=Plugin
Plugin=WebParser
URL=[MeasureValues]
StringIndex=3
;Measure=Calc
;Formula=2+30

[MeasureCalm]
Measure=Calc
Formula=MeasureWindSpeed
IfCondition=(MeasureCalm>0)
IfTrueAction=[!SetOption MeterWind Hidden 0][!UpdateMeter "MeterWind"][!Redraw]
IfFalseAction=[!SetOption MeterWind Hidden 1][!UpdateMeter "MeterWind"][!Redraw]

[MeasureCalmHand]
Measure=Calc
Formula=MeasureWindSpeed
IfCondition=(MeasureCalmHand>0)
IfTrueAction=[!SetOption MeterHand Hidden 0][!UpdateMeter "MeterHand"][!Redraw]
IfFalseAction=[!SetOption MeterHand Hidden 1][!UpdateMeter "MeterHand"][!Redraw]
;-------------------- Meters ----------------------
[MeterBackground]
;Meter=Shape
;Shape=Rectangle 0,0,250,250,2,2 | Fill color 127,127,127,255 | StrokeWidth 2 | Stroke Color 200,200,200,255
;X=1
;Y=1

[MeterWind]
Meter=String
MeasureName=MeasureWindSpeed
MeasureName2=MeasureSpeedUnit
X=5
Y=5
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Left
Text=%1 %2

[MeterCompas]
Meter=Image
ImageName=#@#Images\Comp2.png
X=0
Y=0
;2
w=380
h=380
;W=250
;H=250

[MeterHand]
Meter=Rotator
MeasureName=MeasureDirection
ImageName=#@#Images\arrow
X=126
Y=126
W=5
H=5
OffsetX=1
OffsetY=6
StartAngle=4.7124
RotationAngle=6.2832
ValueRemainder=360

[MeterTextDir]
Meter=String
MeasureName=MeasureDirection
X=120
Y=10
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Left
Text=%1

[MeterHand2]
Meter=Rotator
MeasureName=MeasureDirection
ImageName=#@#Images\Line
X=126
Y=126
OffsetX=1
OffsetY=6
StartAngle=4.7124
RotationAngle=6.2832
ValueRemainder=360
Here's the skin:
https://mega.nz/#!UYYl1IyT!wsJYdKfeibfgFId7d2tRWTyMLi1cleJMkDQEuzqQ6X8

Can you give me some pointers?
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Wind Speed and Direction V1.1.0 Updated

Post by CyberTheWorm »

Looks like the offset are not correct for the hand. I would play around with the Y offset to get it to move down

Code: Select all

X=190
Y=190
OffsetX=0
OffsetY=6
Try adding that for hand2
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Wind Speed and Direction V1.1.0 Updated

Post by CyberTheWorm »

I played with your code and the above will rotate it correctly.

X=<Image width/2>
Y=<Image width/2>
The only thing off was the Y offset
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Wind Speed and Direction V1.1.0 Updated

Post by CyberTheWorm »

Code: Select all

[MeterHand]
Meter=Rotator
MeasureName=MeasureDirection
ImageName=#@#Images\arrow
X=190
Y=190
W=5
H=5
OffsetX=200
OffsetY=181
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
ValueRemainder=360
Once again you need to look at the size and shape of the image to get the correct X,Y and offset values.
X and Y is the initial position of the image (top left of the image as that point), Offset is the point the image rotates around.

That will rotate it but you will still need to play with it to get it looking the way you want.

If you scale the arrow image by 50% size and change Offset X and Y to 90 you will get an arrow that fits in the circle.
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
jminternelia
Posts: 65
Joined: March 21st, 2017, 3:46 am

Re: Wind Speed and Direction V1.1.0 Updated

Post by jminternelia »

I left hand 2 in there just as a guide. Are W and H not usable to resize my hand? I dont need it to git in the circle, rather just need to inner portion of the pointer to rest on the inner edge of the circle.

I was way overthinking this. What I wound up doing instead was just eliminating the [MeterCompas] altogether, combining my arrow and compass, so that the entire image rotates. Not quite as dynamic, but fits with what I am trying to do.

Code: Select all

[MeterBackground]
Meter=Shape
Shape=Rectangle 0,0,782,782,2,2 | Fill color 0,0,0,0 
X=0
Y=0

[MeterWind]
Meter=String
MeasureName=MeasureWindSpeed
MeasureName2=MeasureSpeedUnit
X=5
Y=5
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Left
Text=%1 %2

[MeterHand]
Meter=Rotator
MeasureName=MeasureDirection
ImageName=#@#Images\test
X=391
Y=391
OffsetX=391
OffsetY=391
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
ValueRemainder=360

[MeterTextDir]
Meter=String
MeasureName=MeasureDirection
X=120
Y=10
FontColor=255,255,255,255
AntiAlias=1
StringAlign=Left
Text=%1
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Wind Speed and Direction V1.1.0 Updated

Post by eclectic-tech »

You found an answer, but with modified images, you can get your initial effect.

Code: Select all

[MeterCompas]
Meter=Image
ImageName=#@#Images\Comp3.png
X=0
Y=0
w=380
h=380

[MeterHand]
Meter=Rotator
MeasureName=MeasureDirection
ImageName=#@#Images\arrow3.png
W=380
H=380
OffsetX=190
OffsetY=190
StartAngle=4.7124
RotationAngle=6.2832
ValueRemainder=360
DynamicVariables=1
Comp3.png
Comp3.png
Arrow3.png
arrow3.png
You do not have the required permissions to view the files attached to this post.
jminternelia
Posts: 65
Joined: March 21st, 2017, 3:46 am

Re: Wind Speed and Direction V1.1.0 Updated

Post by jminternelia »

eclectic-tech wrote:You found an answer, but with modified images, you can get your initial effect.

Code: Select all

[MeterCompas]
Meter=Image
ImageName=#@#Images\Comp3.png
X=0
Y=0
w=380
h=380

[MeterHand]
Meter=Rotator
MeasureName=MeasureDirection
ImageName=#@#Images\arrow3.png
W=380
H=380
OffsetX=190
OffsetY=190
StartAngle=4.7124
RotationAngle=6.2832
ValueRemainder=360
DynamicVariables=1
Comp3.pngComp3.png

Arrow3.pngarrow3.png
Aye. I wound up figuring out how to do what I wanted to begin with. I just made the two images the same size, Lined them up in GIMP and subtracted them from each other, then overlaid them.

Code: Select all

[Rainmeter]
Update=1000
DynamicVariables=1
DynamicWindowSize=1
ContextTitle=Use Imperial
ContextAction=[!WriteKeyValue Variables UnitOfMeasure i][!Refresh]
ContextTitle2=Use Metric
ContextAction2=[!WriteKeyValue Variables UnitOfMeasure m][!Refresh]

[Metadata]
Author=CyberTheWorm, Modified by 12A!N
Version=1.1.0 Modified
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0

;-------------------- Variables ----------------------
[Variables]
; CityCode can be obtained at https://openweathermap.org/
CityCode=4393217
; LocationCode can be obtained at http://wxdata.weather.com/wxdata/search/search?where=YourCityName
LocationCode=USKS0298
; UnitOfMeasure can be "i" (Imperial / Fahrenheit) or "m" (Metric / Celsius)
UnitOfMeasure=i
; Locale (language) to use in the feed.
; https://msdn.microsoft.com/en-us/goglobal/bb896001.aspx
; Note that Weather.com uses "_" underline instead of "-" dash in the codes.
Locale=en_US
;To get an API key you need to sign up it's free
APIKey=060a7f4e2eee29acb3e92bca54a697c2

WebSite=https://wxdata.weather.com/wxdata/weather/local/#LocationCode#?cc=*&unit=#UnitOfMeasure#&dayf=1&locale=#Locale#
WebSite2=http://api.openweathermap.org/data/2.5/weather?id=#CityCode#&mode=xml&units=#UnitOfMeasure#&appid=#APIKey#
;-------------------- Measures ----------------------

[MeasureValues]
Measure=Plugin
Plugin=WebParser
URL=#WebSite#
RegExp=(?siU)<us>(.*)</us>.*<s>(.*)</s>.*<d>(.*)</d>
;Update every 15 mins
UpdateRate=9

[MeasureValues2]
Measure=Plugin
Plugin=WebParser
URL=#WebSite2#
RegExp=(?siU).*<city id="(.*)".*name="(.*)".*<sun rise="(.*)".*set="(.*)".*<temperature value="(.*)".* min="(.*)".*max="(.*)".*unit="(.*)".*<humidity value="(.*)".*<pressure value="(.*)".*unit="(.*)".*<speed value="(.*)".*name="(.*)".*<direction value="(.*)".*code="(.*)".*<clouds value="(.*)".*name="(.*)".*<weather number=.*value="(.*)".*icon="(.*)".*<lastupdate value="(.*)"
;Update every 15 mins
UpdateRate=900

[MeasureSpeedUnit]
Measure=Plugin
Plugin=WebParser
URL=[MeasureValues]
StringIndex=1

[MeasureWindSpeed]
Measure=Plugin
Plugin=WebParser
URL=[MeasureValues]
StringIndex=2

[MeasureWindDirection]
Measure=Plugin
Plugin=WebParser
URL=[MeasureValues]
StringIndex=3

[MeasureWindDirection2]
Measure=Plugin
Plugin=WebParser
URL=[MeasureValues2]
StringIndex=15

[MeasureCalm]
Measure=Calc
Formula=MeasureWindSpeed
IfCondition=(MeasureCalm>0)
IfTrueAction=[!SetOption MeterWind Hidden 0][!UpdateMeter "MeterWind"][!Redraw]
IfFalseAction=[!SetOption MeterWind Hidden 1][!UpdateMeter "MeterWind"][!Redraw]

[MeasureCalmHand]
Measure=Calc
Formula=MeasureWindSpeed
IfCondition=(MeasureCalmHand>0)
IfTrueAction=[!SetOption MeterHand Hidden 0][!UpdateMeter "MeterHand"][!Redraw]
IfFalseAction=[!SetOption MeterHand Hidden 1][!UpdateMeter "MeterHand"][!Redraw]

[MeasureWindName]
Measure=Plugin
Plugin=WebParser
URL=[MeasureValues2]
StringIndex=13
Substitute="Gentle":"Moderate"

[MeterWindSpeed]
Meter=String
MeasureName=MeasureWindSpeed
MeasureName2=MeasureSpeedUnit
X=5
Y=5
FontColor=130,209,222
FontFace=earth orbiter
FontSize=15
AntiAlias=1
StringAlign=Left
Text=%1 %2

[MeterWindName]
Meter=String
MeasureName=MeasureWindName
X=200
Y=5
FontColor=130,209,222
FontFace=earth orbiter
FontSize=15
AntiAlias=1
StringAlign=Center
Text=%1

[MeterWindDirection]
Meter=String
MeasureName=MeasureWindDirection2
X=395
Y=5
FontColor=130,209,222
FontFace=earth orbiter
FontSize=15
AntiAlias=1
StringAlign=Right
Text=%1

[MeterX2uiCompass]
Meter=Image
ImageName=#@#Images\X2uiCompass
X=0
Y=0

[MeterX2uiPointer]
Meter=Rotator
MeasureName=MeasureWindDirection
ImageName=#@#Images\X2uiPointer
ImageFlip=Both
X=195
Y=195
OffsetX=195
OffsetY=195
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
ValueRemainder=360
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Wind Speed and Direction V1.1.0 Updated

Post by eclectic-tech »

Yeah, making the graphics 'match' each other simplifies the Rotator coding. We all sometimes overthinking things :D

Using UpdateRate=9 in [MeasureValues] is hitting weather.com every 9 seconds and may get you blocked :x
Might want to change that to match your other webparser, or use the default value (600). :welcome: