It is currently March 28th, 2024, 1:30 pm

[BUG?] ActionTimer Plugin

Report bugs with the Rainmeter application and suggest features.
Post Reply
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

[BUG?] ActionTimer Plugin

Post by kyriakos876 »

Ok so, in the skin below if you got to the Fade.ini file and navigate to the 33-34 lines you should see 2 ActionLists. If I set the waiting time to anything lower than 20, the "Stop 1" and "Stop 2" commands in the lines 66 and 77 won't work and the ActionLists will be executed without stopping when the mouse leaves the meters, Top or Bottom. It will work though, if the waiting number is, for example, 25.

(Simply hover your mouse over the Top or the Bottom of the skin, to see what is going on.)

For some reason though, the waiting number doesn't seem to be an issue to the code below as the waiting time is set to "5" yet the code works as expected.

(The code can also be found here: https://forum.rainmeter.net/viewtopic.php?p=114479#p114479 )

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
SkinWidth=300
SkinHeight=112

[Metadata]
Name=SkinWH
Author=JSMorley
Information=Example of the new SkinWidth / SkinHeight skin options in [Rainmeter].||The ActionTimer plugin used for the demonstration is included.
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Version=Aug 15, 2015

[Variables]
U=[!UpdateMeasureGroup Sliders][!UpdateMeter *][!Redraw]
SlideLeftX=300
SlideRightX=0
SlideDownY=-14
SlideUpY=126

[MeterSlideDownBack]
Meter=Image
X=0
Y=0
W=300
H=28
SolidColor=0,0,0,255
SolidColor2=47,67,87,255
MouseOverAction=[!CommandMeasure SliderDown "Stop 2"][!CommandMeasure SliderDown "Execute 1"]
MouseLeaveAction=[!CommandMeasure SliderDown "Stop 1"][!CommandMeasure SliderDown "Execute 2"]

[MeterSlideDown]
Meter=String
X=150
Y=#SlideDownY#
FontSize=15
FontColor=168,205,240,255
AntiAlias=1
StringAlign=CenterCenter
DynamicVariables=1
Text=Sliding Text Down

[SliderDown]
Group=Sliders
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat SlideDown, 5, 7
SlideDown=[!SetVariable SlideDownY (Clamp(#SlideDownY#+4,-14,14))]#U#
ActionList2=Repeat SlideUp, 5, 7
SlideUp=[!SetVariable SlideDownY (Clamp(#SlideDownY#-4,-14,14))]#U#
DynamicVariables=1

[MeterSlideLeftBack]
Meter=Image
X=0
Y=28
W=300
H=28
SolidColor=0,0,0,255
SolidColor2=47,67,87,255
MouseOverAction=[!CommandMeasure SliderLeft "Stop 2"][!CommandMeasure SliderLeft "Execute 1"]
MouseLeaveAction=[!CommandMeasure SliderLeft "Stop 1"][!CommandMeasure SliderLeft "Execute 2"]

[MeterSlideLeft]
Meter=String
X=#SlideLeftX#
Y=42
FontSize=15
FontColor=168,205,240,255
Padding=10,0,0,0
AntiAlias=1
StringAlign=LeftCenter
DynamicVariables=1
Text=Sliding Text Left

[SliderLeft]
Group=Sliders
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat SlideLeft, 10, 20
SlideLeft=[!SetVariable SlideLeftX (Clamp(#SlideLeftX#-15,0,300))]#U#
ActionList2=Repeat SlideRight, 10, 20
SlideRight=[!SetVariable SlideLeftX (Clamp(#SlideLeftX#+15,0,300))]#U#
DynamicVariables=1

[MeterSlideRightBack]
Meter=Image
X=0
Y=56
W=300
H=28
Solidcolor=0,0,0,255
SolidColor2=47,67,87,255
MouseOverAction=[!CommandMeasure SliderRight "Stop 2"][!CommandMeasure SliderRight "Execute 1"]
MouseLeaveAction=[!CommandMeasure SliderRight "Stop 1"][!CommandMeasure SliderRight "Execute 2"]

[MeterSlideRight]
Meter=String
X=#SlideRightX#
Y=70
FontSize=15
FontColor=168,205,240,255
Padding=0,0,10,0
AntiAlias=1
StringAlign=RightCenter
DynamicVariables=1
Text=Sliding Text Right

[SliderRight]
Group=Sliders
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat SlideRight, 10, 20
SlideRight=[!SetVariable SlideRightX (Clamp(#SlideRightX#+15,0,300))]#U#
ActionList2=Repeat SlideLeft, 10, 20
SlideLeft=[!SetVariable SlideRightX (Clamp(#SlideRightX#-15,0,300))]#U#
DynamicVariables=1

[MeterSlideUpBack]
Meter=Image
X=0
Y=84
W=300
H=28
SolidColor=0,0,0,255
SolidColor2=47,67,87,255
MouseOverAction=[!CommandMeasure SliderUp "Stop 2"][!CommandMeasure SliderUp "Execute 1"]
MouseLeaveAction=[!CommandMeasure SliderUp "Stop 1"][!CommandMeasure SliderUp "Execute 2"]

[MeterSlideUp]
Meter=String
X=150
Y=#SlideUpY#
FontSize=15
FontColor=168,205,240,255
AntiAlias=1
StringAlign=CenterCenter
DynamicVariables=1
Text=Sliding Text Up

[SliderUp]
Group=Sliders
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat SlideUp, 5, 7
SlideUp=[!SetVariable SlideUpY (Clamp(#SlideUpY#-4,98,126))]#U#
ActionList2=Repeat SlideDown, 5, 7
SlideDown=[!SetVariable SlideUpY (Clamp(#SlideUpY#+4,98,126))]#U#
DynamicVariables=1

[MeterOverlay]
Meter=String
X=150
Y=63
FontSize=63
FontColor=150,150,150,50
StringAlign=CenterCenter
StringStyle=Bold
AntiAlias=1
Text=SLIDE
Attachments
Fade_1.0-ish.rmskin
(15.74 KiB) Downloaded 40 times
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: [BUG?] ActionTimer Plugin

Post by kyriakos876 »

The only thing I can think of (if not a bug) is that it's too much for my CPU and it can't update and redraw all the meters/measures that are being updated in the time of <20 miliseconds, and it kinda bottlenecks.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [BUG?] ActionTimer Plugin

Post by balala »

The code has four ActionTimer plugin measures ([SliderDown], [SliderLeft], [SliderRight] and [SliderUp]). Which one are you talking about? None of them has set a greater "waiting time" (as you named it) than 20. On [SliderDown] and [SliderUp] they are set to 5 (on both), while on [SliderLeft] and [SliderRight] to 10. Be careful, this setting is the first number, not the second, in the ActionListX options. The second numbers are representing the number of repetitions. If you set it too low, the plugin won't ran enough times to complete the needed action.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [BUG?] ActionTimer Plugin

Post by jsmorley »

You problem is here in your .rmskin:

Code: Select all

Action1=[!SetVariable ItemY "(Clamp(#ItemY#+10,-140,500))"][!UpdateMeasure MeasureBrowse][!Update][!Redraw]
Action2=[!SetVariable ItemY "(Clamp(#ItemY#-10,-140,500))"][!UpdateMeasure MeasureBrowse][!Update][!Redraw]
In the Actions, you are doing a full update of the skin between each "repeat", that is going to just make Rainmeter entirely unstable. If nothing else, you are updating [MeasureBrowse] TWICE on each "repeat". Once with the [!UpdateMeasure MeasureBrowse], and one with the [!Update]. Yike... Fix that to be [!UpdateMeter *][!Redraw] and it seems to work ok for me, although you ARE asking for a lot to be done in a very short period of time, there is a lot of number noodling going on in those meters, and I can't promise, depending on your CPU and your Rainemter setup, that it will behave really smoothly at low "repeat" rates.

Not quite sure why you posted that code, and then a .rmskin that is something entirely different. Creates a lot of confusion.
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: [BUG?] ActionTimer Plugin

Post by kyriakos876 »

balala wrote:The code has four ActionTimer plugin measures ([SliderDown], [SliderLeft], [SliderRight] and [SliderUp]). Which one are you talking about? None of them has set a greater "waiting time" (as you named it) than 20. On [SliderDown] and [SliderUp] they are set to 5 (on both), while on [SliderLeft] and [SliderRight] to 10.
That's what I'm saying... In my skin this waiting time has to be set higher in order to work.
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: [BUG?] ActionTimer Plugin

Post by kyriakos876 »

jsmorley wrote:You problem is here in your .rmskin:

Code: Select all

Action1=[!SetVariable ItemY "(Clamp(#ItemY#+10,-140,500))"][!UpdateMeasure MeasureBrowse][!Update][!Redraw]
Action2=[!SetVariable ItemY "(Clamp(#ItemY#-10,-140,500))"][!UpdateMeasure MeasureBrowse][!Update][!Redraw]
In the Actions, you are doing a full update of the skin between each "repeat", that is going to just make Rainmeter entirely unstable. If nothing else, you are updating [MeasureBrowse] TWICE on each "repeat". Once with the [!UpdateMeasure MeasureBrowse], and one with the [!Update]. Yike... Fix that to be [!UpdateMeter *][!Redraw] and it seems to work ok for me, although you ARE asking for a lot to be done in a very short period of time, there is a lot of number noodling going on in those meters, and I can't promise, depending on your CPU and your Rainemter setup, that it will behave really smoothly at low "repeat" rates.

Not quite sure why you posted that code, and then a .rmskin that is something entirely different. Creates a lot of confusion.
1) Oops that [!UpdateMeasure MeasureBrowse] is a forgotten leftover of something I was trying. I changed it to

Code: Select all

Action1=[!SetVariable ItemY "(Clamp(#ItemY#+10,-130,760))"][!UpdateMeasure MeasureBrowse][!UpdateMeter *][!Redraw]
Action2=[!SetVariable ItemY "(Clamp(#ItemY#-10,-130,760))"][!UpdateMeasure MeasureBrowse][!UpdateMeter *][!Redraw]
That way I update it only once as you said and update all the meters in the skin as well.

2) The code I posted is to saw that I'm doing pretty much the same thing (Moving a meter on MouseOver) with the same numbers, but in the case of your code (waiting time 5) the "Stop N" command works if the mouse Leaves the meter. In my code it doesn't and executes all of the actions set in ActionList1 no matter if the mouse is over the meter or not, unless the waiting time between each repeat, is greater than 25. Even if it's my CPU that is the problem, shouldn't the mouse leaving the meter stop the repeated action? Even with a delay... In my case it never stops unless it's done.

3) It's not about how smooth it works... it's more like working or not working at all :P In my case it doesn't if waiting time> 25
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: [BUG?] ActionTimer Plugin

Post by balala »

kyriakos876 wrote:That's what I'm saying... In my skin this waiting time has to be set higher in order to work.
It works with any value, including with 1. At least for me, it does.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [BUG?] ActionTimer Plugin

Post by jsmorley »

kyriakos876 wrote:1)... In my case it never stops unless it's done.
Two things I would point out:

Code: Select all

ActionList1=Repeat Action1 , 5 , 65 
ActionList2=Repeat Action2 , 5 , 65
Action1=[!SetVariable ItemY "(Clamp(#ItemY#+10,-140,500))"][!UpdateMeasure MeasureBrowse][!UpdateMeter *][!Redraw]
Action2=[!SetVariable ItemY "(Clamp(#ItemY#-10,-140,500))"][!UpdateMeasure MeasureBrowse][!UpdateMeter *][!Redraw]
1) In your code, you have a "repeat" of 500. That is just overkill. You are moving between a value of -140 and 500, which is a total of 640. You are moving in increments of 10, so that is 64. I made the repeat count 65 to be sure we always get to the top and bottom, but that will always be enough. You are doing a huge amount of extra work by having it repeat 435 times for no reason. It's just slamming itself against -140 and 500 respectively, 435 times. No matter how many times it woodpeckers 500, Clamp() will never let it get through...

2) I fixed the [!Update] and changed it to [!UpdateMeter *]

So for me, it is now stable and works as expected.

HOWEVER. You are right that at very low "wait" times (I use 5 as you can see) you just can't be fast enough with your hands to move the mouse "off" of the meter in question before it has a chance to "stack up" all the actions and execute them. As you say, at a low "repeat" wait, while the MouseLeaveAction is executed, it seems to be too late to stop the execution of the actions. I'm not quite sure what is going on there, maybe brian has more insight.
User avatar
Brian
Developer
Posts: 2673
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: [BUG?] ActionTimer Plugin

Post by Brian »

I really don't have a lot to add that jsmorley hasn't covered.

He hit the nail on the head here:
jsmorley wrote:You are right that at very low "wait" times (I use 5 as you can see) you just can't be fast enough with your hands to move the mouse "off" of the meter in question before it has a chance to "stack up" all the actions and execute them.
With the ActionTimer plugin, it is easy to forget how quickly the commands can 'stack up' (as jsmorley puts it). If you use '5' as the wait time, and repeat that action 65 times, that means to move the 'lines' across the entire height of the skin, it is going to take 5 * 65 milliseconds; which is 325 milliseconds (or 0.325 seconds). That's a very short time to move the mouse off the meter to trigger the 'stops'. Although the plugin will send the bangs to Rainmeter at this rate, Rainmeter can be slow to react because of the overhead to re-reading the values (due to DynamicVariables), updating the measure itself, updating all the meters, and redrawing the skin itself (which is usually the most expensive operation).

At the end of the day, Rainmeter isn't designed for animation. While Rainmeter (using ActionTimer) performs well with simple animations, it can and will quickly get overwhelmed with updating variables, measures, meter and redrawing. The bigger the skin, the worse it gets.

It is worth pointing out that animations with ActionTimer will vary depending on the load the CPU is under, the load Rainmeter is under, and the size and complexity of the skin.

-Brian
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: [BUG?] ActionTimer Plugin

Post by kyriakos876 »

jsmorley wrote:Two things I would point out:

Code: Select all

ActionList1=Repeat Action1 , 5 , 65 
ActionList2=Repeat Action2 , 5 , 65
Action1=[!SetVariable ItemY "(Clamp(#ItemY#+10,-140,500))"][!UpdateMeasure MeasureBrowse][!UpdateMeter *][!Redraw]
Action2=[!SetVariable ItemY "(Clamp(#ItemY#-10,-140,500))"][!UpdateMeasure MeasureBrowse][!UpdateMeter *][!Redraw]
1) In your code, you have a "repeat" of 500. That is just overkill. You are moving between a value of -140 and 500, which is a total of 640. You are moving in increments of 10, so that is 64. I made the repeat count 65 to be sure we always get to the top and bottom, but that will always be enough. You are doing a huge amount of extra work by having it repeat 435 times for no reason. It's just slamming itself against -140 and 500 respectively, 435 times. No matter how many times it woodpeckers 500, Clamp() will never let it get through...

2) I fixed the [!Update] and changed it to [!UpdateMeter *]

So for me, it is now stable and works as expected.

HOWEVER. You are right that at very low "wait" times (I use 5 as you can see) you just can't be fast enough with your hands to move the mouse "off" of the meter in question before it has a chance to "stack up" all the actions and execute them. As you say, at a low "repeat" wait, while the MouseLeaveAction is executed, it seems to be too late to stop the execution of the actions. I'm not quite sure what is going on there, maybe brian has more insight.
Don't mind the numbers of the repeats, they are very off as I'm on the very beginning and haven't done the math yet. What I dont understand is this: When the Mouse is over the top or bottom it orders the execution of the respective ActionList. If the mouse leaves the meter it orders any command that is being executed to stop, thus making all of the unnecessary repeatation to not happen anyway. For example: I tell my friend to shoot the wall 10000000 times but everytime he will check if I told him to stop and then go on on shooting the next bullet. Say he is shooting every 5 milliseconds. No matter what he checks for my permission. If I for some reason say stop, he will stop even if I say the word stop while he firing the gun the message will go through even with some delay. So imagine the mouse is me and rainmeter is the shooter. If the mouse leaves the meter it will send the information that it left the meter no matter of how fast the repeatations are being executed. So I don't see how it matters of I move the mouse off the matter fast or slow is going to effect anything... (before every repeatation has ended ofcourse and there is something to interupt.)
Post Reply