It is currently April 27th, 2024, 12:13 am

ActionTimer can't make repeat work

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: ActionTimer can't make repeat work

Post by jsmorley »

Glad to help!
User avatar
Active Colors
Moderator
Posts: 1255
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: ActionTimer can't make repeat work

Post by Active Colors »

jsmorley wrote: April 22nd, 2021, 11:15 am I hope I was clear. With this action:

Set1=[!SetVariable CurN "(#CurN#+1)"][!Update][!Redraw][!SetVariable CurS "(#CurN#)"][!Update][!Redraw]

What happens is that on each update of the measure the action option is read and parsed. Any formulas or #Variables# will be resolved at that time. So what will be passed to Rainmeter on the first execution of this statement is:

[!SetVariable CurN "(0+1)"][!Update][!Redraw][!SetVariable CurS "(0)"][!Update][!Redraw]

Then the bangs will be executed in order, but in a sense all at once. So even though you have that extra (and pointless) !Update in the middle, it doesn't matter. The ActionTimer plugin has control of things until the action statement is completed. It's too late to "update" the value of #CurN# in the middle, it has already been resolved and set to "0" at that point, and in effect isn't a variable anymore.
It was clear but additional explanation does not hurt, especially that everyone is not on the same level. I appreciate your help.

On the other hand, I want to agree with you about the in-necessity of the middle [!Update] bangs but on the practice I get incorrect result without them.
Capture.PNG
Code:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
OnRefreshAction=[!CommandMeasure CountWActionTimerWithUpdates "Execute 1"][!CommandMeasure CountWActionTimerNoUpdates "Execute 1"]

[Variables]

; Number of meters
N=11

; For the ActionTimer with updates
1CurN=1
1CurS=0
1CurW=0

; For the ActionTimer without updates
2CurN=1
2CurS=0
2CurW=0


[MeterBackground]
Meter=Image
X=0
Y=0
W=320
H=150
SolidColor=0,0,0

[Style]
X=5R
Y=r
W=5
H=20
SolidColor=255,255,255

[Meter1]
Meter=Image
MeterStyle=Style
X=30
Y=30
W=5

[Meter2]
Meter=Image
MeterStyle=Style
W=7

[Meter3]
Meter=Image
MeterStyle=Style
W=2

[Meter4]
Meter=Image
MeterStyle=Style
W=10

[Meter5]
Meter=Image
MeterStyle=Style
W=6

[Meter6]
Meter=Image
MeterStyle=Style
W=2

[Meter7]
Meter=Image
MeterStyle=Style
W=13

[Meter8]
Meter=Image
MeterStyle=Style
W=4

[Meter9]
Meter=Image
MeterStyle=Style
W=11

[Meter10]
Meter=Image
MeterStyle=Style
W=2

[Meter11]
Meter=Image
MeterStyle=Style
W=5



; Count width of all the meters
[CountWCalc]
Measure=Calc
Formula=([Meter1:W]+[Meter2:W]+[Meter3:W]+[Meter4:W]+[Meter5:W]+[Meter6:W]+[Meter7:W]+[Meter8:W]+[Meter9:W]+[Meter10:W]+[Meter11:W])
DynamicVariables=1



; Count width with updates
[CountWActionTimerWithUpdates]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat Set1, 5, #N# | Wait 5 | Set2
Set1=[!SetVariable 1CurN "(#1CurN#+1)"][!Update][!Redraw][!SetVariable 1CurS "([Meter#1CurN#:W])"][!Update][!Redraw][!SetVariable 1CurW "(#1CurW#+#1CurS#)"][!Update][!Redraw]
Set2=[!CommandMeasure CountWActionTimerWithUpdatesFINAL "Execute 1"][!Update]
UpdateDivider=1
DynamicVariables=1
Disabled=0

[CountWActionTimerWithUpdatesFINAL]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Set3
Set3=[!SetVariable 1CurW "(#1CurW#+#1CurS#)"][!Update][!Redraw]
UpdateDivider=1
DynamicVariables=1
Disabled=0



; Count width without updates
[CountWActionTimerNoUpdates]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat Set1no, 5, #N#  | Wait 5 | Set2no
Set1no=[!SetVariable 2CurN "(#2CurN#+1)"][!SetVariable 2CurS "([Meter#2CurN#:W])"][!SetVariable 2CurW "(#2CurW#+#2CurS#)"][!Update]
Set2no=[!CommandMeasure CountWActionTimerNoUpdatesFINAL "Execute 1"][!Update]
UpdateDivider=1
DynamicVariables=1
Disabled=0

[CountWActionTimerNoUpdatesFINAL]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Set3no
Set3no=[!SetVariable 2CurW "(#2CurW#+#2CurS#)"][!Update][!Redraw]
UpdateDivider=1
DynamicVariables=1
Disabled=0



[Report]
Meter=String
MeasureName=CountWCalc
X=30
Y=70
FontFace=Arial
FontSize=11
FontColor=255,255,255
AntiAlias=1
Text=%1 — Calc sum of all the meters' width #CRLF##1CurW# — ActionTimer with updates #CRLF##2CurW# — ActionTimer without updates
DynamicVariables=1
You do not have the required permissions to view the files attached to this post.
User avatar
Active Colors
Moderator
Posts: 1255
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: ActionTimer can't make repeat work

Post by Active Colors »

Well, strange thing happens. When you have middle [!Update] bangs but don't have middle [!Redraw] bangs the skin reports different values on every refresh.


Pay attention to 1CurN, 1CurS, 1CurW in the About window:
GIF.gif



It is the same skin as above just without the [!Redraw] bangs.

This situation kind of reminds me of this https://forum.rainmeter.net/viewtopic.php?f=14&t=35740&start=10#p180485
except that here you get different result every time.
You do not have the required permissions to view the files attached to this post.