It is currently May 27th, 2020, 2:57 am

Action Timer stopping animation after turning off the display

Help with creating, editing & fixing problems with skins
User avatar
Yincognito
Posts: 1639
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Action Timer stopping animation after turning off the display

Post by Yincognito »

jsmorley wrote:
February 17th, 2020, 3:18 pm
Been running for a while now without any "hang", but I suspect it will sooner or later. I have no idea what "alignment of planets" causes it, but I would certainly consider this fatally unreliable.
Yeah, in my case, just came back after a cigar and there it is, the mighty freeze again. I just wished I didn't update Rainmeter to the latest beta, as it complicates a little finding the culprit. Personally, I somehow doubt that it's the code in the skin itself - if that would be right, the forum would abound of posts signaling ActionTimer freezes. I mean, I'm surely not the only one using ActionTimer indefinitely (or for a period longer than a couple of minutes), am I?

Anyway, I think I will revert to the previous Rainmeter version (let's see if I can remember which one was it) and see if this still happens. At least to get rid of one possibility...
User avatar
jsmorley
Developer
Posts: 20650
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Action Timer stopping animation after turning off the display

Post by jsmorley »

I really think this is going to be a problem for never-ending animations. I strongly feel that ActionTimer measures need to be allowed to "start", "run", and "finish" entirely, giving the plugin time to unload, take a breath and reset, before it is called again.
User avatar
jsmorley
Developer
Posts: 20650
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Action Timer stopping animation after turning off the display

Post by jsmorley »

I really think you ARE one of the few using ActionTimer in a circular, self-referencing, never-ending way. We have strongly discouraged that from the very beginning.
User avatar
jsmorley
Developer
Posts: 20650
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Action Timer stopping animation after turning off the display

Post by jsmorley »

You might try this to see if it is more reliable over the long-haul:

Code: Select all

[Rainmeter]
AccurateText=1
OnRefreshAction=[!CommandMeasure MeasureActionTimer1 "Execute 1"]

[Variables]
ContainerWidth=136
TextWidth=0
Counter=0
CurrentStep=1
SlidingUpdate=24
Text="Wed, 00 May 2020   ●   ‒000 °C   ●   Showers Early / Clearing Late"

---Measures---

[ContainerWidthCalc]
Measure=Calc
Formula=#ContainerWidth#+#TextWidth#

[MeasureActionTimer1]
Measure=Plugin
Group=AT
Plugin=ActionTimer
ActionList1=Repeat Move1,#SlidingUpdate#,[ContainerWidthCalc] | Wait #SlidingUpdate# | DoOver1
Move1=[!SetVariable Counter "((#Counter#<0)?(#ContainerWidth#+#TextWidth#):((#Counter#>(#ContainerWidth#+#TextWidth#))?(0):(#Counter#+#CurrentStep#)))"][!UpdateMeasureGroup "AT"][!SetOption MeterText X "(#ContainerWidth#-#Counter#)"][!UpdateMeter *][!Redraw]
DoOver1=[!CommandMeasure MeasureActionTimer2 "Execute 1"]
DynamicVariables=1

[MeasureActionTimer2]
Measure=Plugin
Group=AT
Plugin=ActionTimer
ActionList1=Repeat Move1,#SlidingUpdate#,[ContainerWidthCalc] | Wait #SlidingUpdate# | DoOver1
Move1=[!SetVariable Counter "((#Counter#<0)?(#ContainerWidth#+#TextWidth#):((#Counter#>(#ContainerWidth#+#TextWidth#))?(0):(#Counter#+#CurrentStep#)))"][!UpdateMeasureGroup "AT"][!SetOption MeterText X "(#ContainerWidth#-#Counter#)"][!UpdateMeter *][!Redraw]
DoOver1=[!CommandMeasure MeasureActionTimer1 "Execute 1"]
DynamicVariables=1

---Meters---

[MeterBackground]
Meter=Shape
Shape=Rectangle 0,0,168,13 | StrokeWidth 0.5 | Stroke Color 255,64,32 | Fill Color 32,32,32,128
UpdateDivider=-1

[MeterTitle]
Meter=String
ClipString=2
FontFace=Tahoma
FontSize=7
AntiAlias=1
FontWeight=700
FontColor=255,255,255,255
StringEffect=Shadow
FontEffectColor=0,0,0,255
X=2
Y=0
Text=WEA
UpdateDivider=-1

[MeterContainer]
Meter=Shape
X=31
Y=0
Shape=Rectangle 0,0,136,13 | Fill Color 0,0,0,255 | StrokeWidth 0
UpdateDivider=-1

[MeterText]
Meter=String
Container=MeterContainer
FontFace=Tahoma
FontSize=7
FontWeight=400
FontColor=160,255,160,255
FontEffectColor=0,0,0,255
StringEffect=Shadow
Antialias=1
ClipString=0
InlineSetting=Color | 128,255,255,255
InlinePattern="^([^●]*)   ●"
InlineSetting2=Color | 255,255,255,255
InlinePattern2="(   ●   )"
InlineSetting3=Color | 255,224,128,255
InlinePattern3="●   ([^●]*)$"
X=(#ContainerWidth#/2)
Y=0
Text=#Text#
UpdateDivider=-1
OnUpdateAction=[!SetVariable TextWidth [MeterText:W]]
DynamicVariables=1
Since the two ActionTimer measures are "sharing" and updating the same #Variable#, but they are both always kept updated, I don't think any "Stop" is needed with this. Doesn't really matter which measure is updating the #Variable# in a sense.
User avatar
Yincognito
Posts: 1639
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Action Timer stopping animation after turning off the display

Post by Yincognito »

jsmorley wrote:
February 17th, 2020, 3:57 pm
You might try this to see if it is more reliable over the long-haul:

[...]

Since the two ActionTimer measures are "sharing" and updating the same #Variable#, but they are both always kept updated, I don't think any "Stop" is needed with this. Doesn't really matter which measure is updating the #Variable# in a sense.
This seems like a good idea. Just got the hang in the previous Rainmeter version, so will try this right away and see how it goes. ;-)
User avatar
jsmorley
Developer
Posts: 20650
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Action Timer stopping animation after turning off the display

Post by jsmorley »

After looking at it for a bit, I think the "Stop" might still be useful, so you are not potentially using extra CPU cycles having both measures running at the same time.
User avatar
jsmorley
Developer
Posts: 20650
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Action Timer stopping animation after turning off the display

Post by jsmorley »

Just as as aside, wouldn't a Clamp(num,low,high) function be just as effective and far more simple than the "conditional" formula?

I haven't really looked closely at it, but it feels to me like you might be "building" your own Clamp() function from scratch...

Edit: Maybe not...
User avatar
Yincognito
Posts: 1639
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Action Timer stopping animation after turning off the display

Post by Yincognito »

jsmorley wrote:
February 17th, 2020, 4:03 pm
After looking at it for a bit, I think the "Stop" might still be useful, so you are not potentially using extra CPU cycles having both measures running at the same time.
Will try that as well, after I see whether the 2 APs version hangs or not. UPDATE: I was just writing this message, when it hanged as well, so will do that shortly.
jsmorley wrote:
February 17th, 2020, 4:08 pm
Just as as aside, wouldn't a Clamp(num,low,high) function be just as effective and far more simple than the "conditional" formula?

I haven't really looked closely at it, but it feels to me like you might be "building" your own Clamp() function from scratch...
That may very well be. I'll see if Clamp() is suitable in all the scenarios I may use it. I remember not "switching" to the Loop measure for a similar reason, but that's a different story.
User avatar
jsmorley
Developer
Posts: 20650
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Action Timer stopping animation after turning off the display

Post by jsmorley »

Been running for 20 minutes or so for me without issue. I'll leave it running for a while.
User avatar
Yincognito
Posts: 1639
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Action Timer stopping animation after turning off the display

Post by Yincognito »

jsmorley wrote:
February 17th, 2020, 4:19 pm
Been running for 20 minutes or so for me without issue. I'll leave it running for a while.
Are you using the stops or not?
Me, I just began testing the stop featured version. If this one hangs as well, will try increasing the wait time (i.e. #SlidingUpdate# variable) to 240 (10 times more than before), to see how it goes. Oops, I didn't yet finished writing and it hanged - time for the 240 milliseconds version. This way, I will eliminate the "too many Windows messages freeze" possibility. Fingers crossed, LOL...