It is currently April 26th, 2024, 12:48 am

Dynamic wallpaper

Get help with creating, editing & fixing problems with skins
ItsJustRyan
Posts: 81
Joined: October 25th, 2019, 1:20 am

Dynamic wallpaper

Post by ItsJustRyan »

Hi!
So i made this skin where when you click on a triangle (left or right side of a triangle) it sets a different wallpaper. Right now, I'm trying to make one of the triangles basically set it to a dynamic wallpaper. The way it works is that i have a measure that detects the time and sets a variable to the name of that wallpaper for that time, and another measure to set that wallpaper if that triangle is clicked. I also made a string meter to see if the variables are all correct, and the button does what its meant to etc, yet the wallpaper isnt actually set or changing. What's wrong with it?

Code: Select all

[Rainmeter]
Update=1

[Variables]
@include=#@#Images.inc
dwp=0

[Hour]
Measure=Time
Format=%H
IfCondition=(Hour >= 4) && (Hour <= 6)
IfTrueAction=[!SetVariable "wp" "1"]
IfCondition2=(Hour >= 7) && (Hour <= 9)
IfTrueAction2=[!SetVariable "wp" "2"]
IfCondition3=(Hour >= 10) && (Hour <= 12)
IfTrueAction3=[!SetVariable "wp" "3"]
IfCondition4=(Hour >= 13) && (Hour <= 15)
IfTrueAction4=[!SetVariable "wp" "4"]
IfCondition5=(Hour >= 16) && (Hour <= 18)
IfTrueAction5=[!SetVariable "wp" "5"]
IfCondition6=(Hour >= 19) && (Hour <= 21)
IfTrueAction6=[!SetVariable "wp" "6"]
IfCondition7=(Hour >= 22) && (Hour <= 23)
IfTrueAction7=[!SetVariable "wp" "7"]
IfCondition8=(Hour >= 24) && (Hour <= 3)
IfTrueAction8=[!SetVariable "wp" "8"]
DynamicVariables=1

[Click1]
Meter=Image
ImageName=#@#Images/3.png
W=28
H=28
AntiAlias=1
ImageFlip=vertical
ImageTint=255,165,0
LeftMouseUpAction=[!SetWallpaper cicle.jpg center]
LeftMouseDownAction=[!SetVariable "dwp" "0"]

[Click12]
Meter=Image
ImageName=#@#Images/3.png
W=28
x=28
H=28
AntiAlias=1
ImageFlip=both
ImageTint=255,165,0
LeftMouseUpAction=[!SetWallpaper Day.jpg]
LeftMouseDownAction=[!SetVariable "dwp" "0"]

[Click2]
Meter=Image
ImageName=#@#Images/3.png
W=28
x=150
H=28
AntiAlias=1
ImageFlip=vertical
ImageTint=255,165,0
LeftMouseUpAction=[!SetWallpaper Laugh.jpg FIll]
LeftMouseDownAction=[!SetVariable "dwp" "0"]

[Click22]
Meter=Image
ImageName=#@#Images/3.png
W=28
x=178
H=28
AntiAlias=1
ImageFlip=both
ImageTint=255,165,0
LeftMouseUpAction=[!SetWallpaper Night.jpg]
LeftMouseDownAction=[!SetVariable "dwp" "0"]

[Click3]
Meter=Image
ImageName=#@#Images/3.png
W=28
x=343
H=28
AntiAlias=1
ImageFlip=vertical
ImageTint=255,165,0
LeftMouseUpAction=[!SetWallpaper "mn 2.png" center]
LeftMouseDownAction=[!SetVariable "dwp" "0"]

[Click32]
Meter=Image
ImageName=#@#Images/3.png
W=28
x=371
H=28
AntiAlias=1
ImageFlip=both
ImageTint=255,165,0
LeftMouseUpAction=[!SetWallpaper Landscape.jpg Fill]
LeftMouseDownAction=[!SetVariable "dwp" "0"]

[Click4]
Meter=Image
ImageName=#@#Images/3.png
W=28
x=489
H=28
AntiAlias=1
ImageFlip=vertical
ImageTint=255,165,0
LeftMouseUpAction=[!SetWallpaper nose.jpg center]
LeftMouseDownAction=[!SetVariable "dwp" "0"]

;[dwpi]
;Measure=Calc
;IfCondition=(dwp = 1)
;IfTrueAction=[!SetVariable "dwpi" "1"][!Update]
;DynamicVariables=1

;[ToggleState2]
;Measure=Calc
;IfCondition=(dwp = 1)
;IfTrueAction=[!SetVariable "dwpi" "0"][!Update]
;DynamicVariables=1

[Click42]
Meter=Image
ImageName=#@#Images/3.png
W=28
x=517
H=28
AntiAlias=1
ImageFlip=both
ImageTint=255,165,0
;LeftMouseUpAction=[!SetWallpaper #wp#.png fit]
LeftMouseUpAction=[!SetVariable "dwp" "1"]
IfCondition=(dwp >= 1)
IfTrueAction=[!SetWallpaper #wp#.png fit]
DynamicVariables=1

;[DynamWP]
;Measure=Calc
;MeasureName=dwp
;IfCondition=(dwp >= 1)
;IfTrueAction=[!SetWallpaper #wp#.png fit]
;DynamicVariables=1

[TextState]
Meter=String
x=530
Text=DWP #dwp#,WP #wp#
DynamicVariables=1
[code]
User avatar
Yamajac
Posts: 134
Joined: June 30th, 2014, 8:44 am

Re: Dynamic wallpaper

Post by Yamajac »

You're using an ifcondition on a meter. These only work on a measure. I can't test your code cause !SetWallpaper doesn't work for my system (and you didn't provide all the relevant files anyway) but if you put the IfCondition checking for dwp >= 1 on a measure instead that should at least fix something.


Another thing I'd like to say is Rainmeter only updates every 16ms at most, so Update=1 and Update=16 are the same thing.



O and one more thing, variables are referenced with #varname#. dwp is nothing, #dwp# is what you'd use.
ItsJustRyan
Posts: 81
Joined: October 25th, 2019, 1:20 am

Re: Dynamic wallpaper

Post by ItsJustRyan »

thanks! I've managed to fix it.
ItsJustRyan
Posts: 81
Joined: October 25th, 2019, 1:20 am

Re: Dynamic wallpaper

Post by ItsJustRyan »

Its working now, except that it doesnt automatically change when it reaches the time. what do i do?

Code: Select all

[Rainmeter]
Update=16

[Variables]
@include=#@#Images.inc

[Hour]
Measure=Time
Format=%H
IfCondition=(Hour >= 4) && (Hour <= 6)
IfTrueAction=[!SetVariable "wp" "1"]
IfCondition2=(Hour >= 7) && (Hour <= 9)
IfTrueAction2=[!SetVariable "wp" "2"]
IfCondition3=(Hour >= 10) && (Hour <= 12)
IfTrueAction3=[!SetVariable "wp" "3"]
IfCondition4=(Hour >= 13) && (Hour <= 15)
IfTrueAction4=[!SetVariable "wp" "4"]
IfCondition5=(Hour >= 16) && (Hour <= 18)
IfTrueAction5=[!SetVariable "wp" "5"]
IfCondition6=(Hour >= 19) && (Hour <= 21)
IfTrueAction6=[!SetVariable "wp" "6"]
IfCondition7=(Hour >= 22) && (Hour <= 23)
IfTrueAction7=[!SetVariable "wp" "7"]
IfCondition8=(Hour >= 24) && (Hour <= 3)
IfTrueAction8=[!SetVariable "wp" "8"]
DynamicVariables=1

[idk]
Measure=calc
IfCondition=(#dwp# = 1)
IfTrueAction=[!SetWallpaper #wp#.png fit][!Update]
DynamicVariables=1

[Click1]
Meter=Image
ImageName=#@#Images/3.png
W=28
H=28
AntiAlias=1
ImageFlip=vertical
ImageTint=255,165,0
LeftMouseUpAction=[!SetWallpaper cicle.jpg center]
LeftMouseDownAction=[!SetVariable "dwp" "0"]

[Click12]
Meter=Image
ImageName=#@#Images/3.png
W=28
x=28
H=28
AntiAlias=1
ImageFlip=both
ImageTint=255,165,0
LeftMouseUpAction=[!SetWallpaper Day.jpg]
LeftMouseDownAction=[!SetVariable "dwp" "0"]

[Click2]
Meter=Image
ImageName=#@#Images/3.png
W=28
x=150
H=28
AntiAlias=1
ImageFlip=vertical
ImageTint=255,165,0
LeftMouseUpAction=[!SetWallpaper Laugh.jpg FIll]
LeftMouseDownAction=[!SetVariable "dwp" "0"]

[Click22]
Meter=Image
ImageName=#@#Images/3.png
W=28
x=178
H=28
AntiAlias=1
ImageFlip=both
ImageTint=255,165,0
LeftMouseUpAction=[!SetWallpaper Night.jpg]
LeftMouseDownAction=[!SetVariable "dwp" "0"]

[Click3]
Meter=Image
ImageName=#@#Images/3.png
W=28
x=343
H=28
AntiAlias=1
ImageFlip=vertical
ImageTint=255,165,0
LeftMouseUpAction=[!SetWallpaper "mn 2.png" center]
LeftMouseDownAction=[!SetVariable "dwp" "0"]

[Click32]
Meter=Image
ImageName=#@#Images/3.png
W=28
x=371
H=28
AntiAlias=1
ImageFlip=both
ImageTint=255,165,0
LeftMouseUpAction=[!SetWallpaper Landscape.jpg Fill]
LeftMouseDownAction=[!SetVariable "dwp" "0"]

[Click4]
Meter=Image
ImageName=#@#Images/3.png
W=28
x=489
H=28
AntiAlias=1
ImageFlip=vertical
ImageTint=255,165,0
LeftMouseUpAction=[!SetWallpaper nose.jpg center]
LeftMouseDownAction=[!SetVariable "dwp" "0"]

;[dwpi]
;Measure=Calc
;IfCondition=(dwp = 1)
;IfTrueAction=[!SetVariable "dwpi" "1"][!Update]
;DynamicVariables=1

;[ToggleState2]
;Measure=Calc
;IfCondition=(dwp = 1)
;IfTrueAction=[!SetVariable "dwpi" "0"][!Update]
;DynamicVariables=1

[Click42]
Meter=Image
ImageName=#@#Images/3.png
W=28
x=517
H=28
AntiAlias=1
ImageFlip=both
ImageTint=255,165,0
;LeftMouseUpAction=[!SetWallpaper #wp#.png fit]
LeftMouseUpAction=[!SetVariable "dwp" "1"]

DynamicVariables=1

;[DynamWP]
;Measure=Calc
;MeasureName=dwp
;IfCondition=(dwp >= 1)
;IfTrueAction=[!SetWallpaper #wp#.png fit]
;DynamicVariables=1

;[TextState]
;Meter=String
;x=530
;Text=DWP #dwp#,WP #wp#
;DynamicVariables=1

[TextWPno]
Meter=string
x=511
y=10
FontFace=Lato
FontWeight=500
Text= #wp#
DynamicVariables=1
[code]
User avatar
Yamajac
Posts: 134
Joined: June 30th, 2014, 8:44 am

Re: Dynamic wallpaper

Post by Yamajac »

Code: Select all

[idk]
Measure=calc
IfCondition=(#dwp# = 1)
IfTrueAction=[!SetWallpaper #wp#.png fit][!Update]
DynamicVariables=1

This will check if #dwp# = 1 and then run IfTrueAction. After that, IfTrueAction won't get run again until the condition fails and passes again.

To fix this, you'd wanna use IfConditionMode = 1.

And although a part of me really wants to be mean and let you run that as is, I won't. Your [!Update] bang will update that measure, which will evaluate the condition again, and update the measure again, etc. Eventually (instantly but eventually in computer time) crashing rainmeter.
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Dynamic wallpaper

Post by balala »

Yamajac wrote: November 22nd, 2019, 5:37 am Your [!Update] bang will update that measure,
Right, but just to be precise, !Update updates not just the measure, but the whole skin.