It is currently November 29th, 2020, 6:46 pm

HELP: ActionTimer. Is it possible to STOP the completion of the ActionList1 on a second mouseover action?

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

Re: HELP: ActionTimer. Is it possible to STOP the completion of the ActionList1 on a second mouseover action?

Post by Yincognito »

strawberryshortcake wrote: October 16th, 2020, 6:09 pm :thumbup: I appreciate your help. I'll try to do better next time. I'll redo the steps when I get a chance this week/weekend.

And I have to apologize for being stupid. There's intelligent people, and then unfortunately, there's people like me that will take more effort to hopefully get things right.
I didn't say you were stupid - I just said you didn't pay attention to what has already been written. Sorry for the misunderstanding and I apologize if you felt offended. But then, it's normal for a beginner to be a bit chaotic, and I was a beginner as well, so no problem with that. I probably made the mistake of expecting you to understand things about the code that were unrealistic for the level you're currently at when it comes to Rainmeter. You will surely progress as we all did - and that does NOT mean you're currently stupid or any such nonsense. ;-)

Now that being said, I just began editing the code to set things right. Hopefully I'll be able to do that and still maintain the desired behavior.
User avatar
Yincognito
Posts: 2933
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: HELP: ActionTimer. Is it possible to STOP the completion of the ActionList1 on a second mouseover action?

Post by Yincognito »

strawberryshortcake wrote: October 16th, 2020, 6:09 pmI will need to redo it so it's written correctly.
I'll try to do that for you, but for some reason the 3 colored balls don't seem to appear when loading the skin, even though they do in your videos. I simply extracted __Just A Bin (Animation).zip and replaced the code in Yincognito CODE.ini with your last posted one.

Will keep investigating this.

EDIT: Got it - an action needs to happen for that animation to start.
User avatar
balala
Rainmeter Sage
Posts: 11827
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: HELP: ActionTimer. Is it possible to STOP the completion of the ActionList1 on a second mouseover action?

Post by balala »

strawberryshortcake wrote: October 16th, 2020, 6:09 pm And I have to apologize for being stupid. There's intelligent people, and then unfortunately, there's people like me that will take more effort to hopefully get things right.
Forget this! Not being enoughly experienced in coding or not knowing how are different things working in Rainmeter, doesn't mean you are stupid. The purpose of this forum is, among others, exactly to let people learning. Probably most of us (except maybe jsmorley and very few others), have started the same way: asking for help here on the forum and trying to continously learn while we've coded. So, no, YOU ARE NOT STUPID!!!. Everyone who invests time and effort, succeeds.
User avatar
Yincognito
Posts: 2933
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: HELP: ActionTimer. Is it possible to STOP the completion of the ActionList1 on a second mouseover action?

Post by Yincognito »

As promised, here is the updated code:
AnimatedBin_1.0.0.rmskin
As far as I can tell, it checks every box in the video, and in addition, it:
  • is more compact, for the sake of clarity avoiding redundancy
  • corrects the many duplicate UpdateDividers for the same measures/meters that existed in the previous code, as well as obsolete bangs
  • adds playing the sound (had to find one online, as it wasn't included in the 2 packages I had at my disposal) on every raindrop, based on the moment when the raindrop falls, so now, as long as one raindrop means 12 frames, you can either decrease or increase the frame count (assuming the images exist) to have less or more raindrops and the sound will play for as many raindrops as there are in total (this is true for the endless animation as well: every raindrop will generate a sound; this can of course be adjusted, to limit on how many raindrops the sound is desired, let me know if you want to)
  • adds the sphere animation to the general one, in the same ActionTimer measure; this means that the skin can safely have a larger update rate (I left it as 1000 ms, i.e. 1 second) without interfering with the animations; this also means that the stutter in the sphere animation is gone, as it isn't based on the seconds time anymore, but on incrementing a variable in the ActionTimer measure; also, the sphere animation "speed" is easily adjustable on an independent basis, by changing the value of the SpheresAngleIncrement variable; the spheres rotation radiuses are adjustable as well, by changing the value of the SphereRotationRadius (so far all 3 spheres have the same rotational radius, but this can be adjusted if you create and use 3 radius variables instead of just 1)
I removed all the unneeded or unused files, comments, measures, meters, etc. (they just created more confusion than being actually useful), so make sure you add what you really need back.

Some info on the variables (the [Variables] section is the main place where things can be adjusted):
- TriggerSlide: initially 0, used to trigger the animations on mouse over
- Frame: initially 0, it's the current frame number in the raindrop animation
- FrameCount: the total number of frames in the raindrop animation; its change will affect the number of played raindrop sounds accordingly
- SpheresAngle: initially 0, the angle in degrees of the spheres rotation; this is added to the adjustable value of StartAngle in the sphere meters
- SpheresAngleIncrement: by how many degrees the angle of the spheres rotation is incremented in the ActionTimer measure
- Speed: the wait time in milliseconds between the animation sequence "steps" in the ActionTimer measure
- BinIconSize: size of the recycle bin icon in pixels; I left the icon there, although it doesn't look that well, probably needs to be moved or removed
- BinIconEmpty: the path and file name of the empty recycle bin icon
- BinIconFull: the path and file name of the full recycle bin icon
- SphereSize: the size in pixels of a sphere image; due to how Rotator meters are designed, resizing the image itself externally is needed to adjust the size of the image
- SphereRotationRadius: the length in pixels of the radius of the circles on which the spheres are rotated
- SphereWhite_X: the center of rotation's X for the white sphere
- SphereWhite_Y: the center of rotation's Y for the white sphere
- SphereBlue_X: the center of rotation's X for the blue sphere
- SphereBlue_Y: the center of rotation's Y for the blue sphere
- SphereGreen_X: the center of rotation's X for the green sphere
- SphereGreen_Y: the center of rotation's Y for the green sphere
- U: the bangs executed after an animation sequence "step" in the ActionTimer measure
- Action1: the bangs executed when the one time animation (i.e. Action1 in the ActionTimer measure) is triggered
- Action2: the bangs executed when the endless animation (i.e. Action2 in the ActionTimer measure) is triggered

Other useful info:
  • since the value of the Sgn() function is 0 for 0 and 1 for positive numbers (and adding 1 to it yields precisely the number of the animation that should be used for MeasureBinCount values), I used the (Sgn(MeasureBinCount)+1) formula in [MeasureAction] to get the animation "index" needed to be triggered
  • since MeasureAction already holds the number / index of the needed animation, it can be easily used to execute the appropriate bang sequence stored in the corresponding variables (i.e. Action1 and Action2) from the [Variables] section. Thus, with a little help from the nested variable syntax (which allows to have the name and value of a variable in another variable name), the conditional actions in [MeasureAction] can be written as [#Action[&MeasureAction]], meaning Rainmeter will choose the correct Action1 or Action2 variable ([# part means variable) based on the value of the MeasureAction measure ([& part means measure).
In other words, if MeasureBinCount is, say, 20, then:
  • the [MeasureAction] formula yields (Sgn(MeasureBinCount)+1) = (Sgn(20)+1) = (1+1) = 2
  • the [MeasureAction] will, in the conditionals handling the bin count and the triggering by mouse over, execute [#Action[&MeasureAction]] = [#Action2] = #Action2# variable, which is already appropriately declared in the [Variables] section as the desired sequence of bangs
That's pretty much it, hopefully it will be of some use - if you have any other questions, don't hesitate to ask, wihout being concerned about reading between the lines of an internet post (which can often be misleading). I'm a direct and honest guy, I say things as they are without hiding around the bush - but again, as I said, I was referring to paying attention to what has been written already (for example, "[MeasureBinCount] simulates a recycle bin count (in your code, it would be the actual recycle bin count measure)", that kind of things) and NOT to anyone's intelligence.

As always, feel free to adjust and adapt things to your preference in the above code.
You do not have the required permissions to view the files attached to this post.
User avatar
strawberryshortcake
Posts: 79
Joined: August 27th, 2016, 12:49 am

Re: HELP: ActionTimer. Is it possible to STOP the completion of the ActionList1 on a second mouseover action?

Post by strawberryshortcake »

Yincognito wrote: October 16th, 2020, 6:24 pm
I didn't say you were stupid - I just said you didn't pay attention to what has already been written. Sorry for the misunderstanding and I apologize if you felt offended. But then, it's normal for a beginner to be a bit chaotic, and I was a beginner as well, so no problem with that. I probably made the mistake of expecting you to understand things about the code that were unrealistic for the level you're currently at when it comes to Rainmeter. You will surely progress as we all did - and that does NOT mean you're currently stupid or any such nonsense. ;-)

Now that being said, I just began editing the code to set things right. Hopefully I'll be able to do that and still maintain the desired behavior.
I should have phrased it differently. In general, if I don't get something, or did it incorrectly, and needing to spend more time on it than what seems to be normal, I feel stupid.
balala wrote: October 16th, 2020, 6:58 pm
Forget this! Not being enoughly experienced in coding or not knowing how are different things working in Rainmeter, doesn't mean you are stupid. The purpose of this forum is, among others, exactly to let people learning. Probably most of us (except maybe jsmorley and very few others), have started the same way: asking for help here on the forum and trying to continously learn while we've coded. So, no, YOU ARE NOT STUPID!!!. Everyone who invests time and effort, succeeds.
I should have phrased it differently. In general, if I don't get something, or did it incorrectly, and needing to spend more time on it than what seems to be normal, I feel stupid.
User avatar
strawberryshortcake
Posts: 79
Joined: August 27th, 2016, 12:49 am

Re: HELP: ActionTimer. Is it possible to STOP the completion of the ActionList1 on a second mouseover action?

Post by strawberryshortcake »

Yincognito wrote: October 17th, 2020, 2:36 pm
As promised, here is the updated code:
AnimatedBin_1.0.0.rmskin
As far as I can tell, it checks every box in the video, and in addition, it:
  • is more compact, for the sake of clarity avoiding redundancy
  • corrects the many duplicate UpdateDividers for the same measures/meters that existed in the previous code, as well as obsolete bangs
  • adds playing the sound (had to find one online, as it wasn't included in the 2 packages I had at my disposal) on every raindrop, based on the moment when the raindrop falls, so now, as long as one raindrop means 12 frames, you can either decrease or increase the frame count (assuming the images exist) to have less or more raindrops and the sound will play for as many raindrops as there are in total (this is true for the endless animation as well: every raindrop will generate a sound; this can of course be adjusted, to limit on how many raindrops the sound is desired, let me know if you want to)
  • adds the sphere animation to the general one, in the same ActionTimer measure; this means that the skin can safely have a larger update rate (I left it as 1000 ms, i.e. 1 second) without interfering with the animations; this also means that the stutter in the sphere animation is gone, as it isn't based on the seconds time anymore, but on incrementing a variable in the ActionTimer measure; also, the sphere animation "speed" is easily adjustable on an independent basis, by changing the value of the SpheresAngleIncrement variable; the spheres rotation radiuses are adjustable as well, by changing the value of the SphereRotationRadius (so far all 3 spheres have the same rotational radius, but this can be adjusted if you create and use 3 radius variables instead of just 1)
I removed all the unneeded or unused files, comments, measures, meters, etc. (they just created more confusion than being actually useful), so make sure you add what you really need back.

Some info on the variables (the [Variables] section is the main place where things can be adjusted):
- TriggerSlide: initially 0, used to trigger the animations on mouse over
- Frame: initially 0, it's the current frame number in the raindrop animation
- FrameCount: the total number of frames in the raindrop animation; its change will affect the number of played raindrop sounds accordingly
- SpheresAngle: initially 0, the angle in degrees of the spheres rotation; this is added to the adjustable value of StartAngle in the sphere meters
- SpheresAngleIncrement: by how many degrees the angle of the spheres rotation is incremented in the ActionTimer measure
- Speed: the wait time in milliseconds between the animation sequence "steps" in the ActionTimer measure
- BinIconSize: size of the recycle bin icon in pixels; I left the icon there, although it doesn't look that well, probably needs to be moved or removed
- BinIconEmpty: the path and file name of the empty recycle bin icon
- BinIconFull: the path and file name of the full recycle bin icon
- SphereSize: the size in pixels of a sphere image; due to how Rotator meters are designed, resizing the image itself externally is needed to adjust the size of the image
- SphereRotationRadius: the length in pixels of the radius of the circles on which the spheres are rotated
- SphereWhite_X: the center of rotation's X for the white sphere
- SphereWhite_Y: the center of rotation's Y for the white sphere
- SphereBlue_X: the center of rotation's X for the blue sphere
- SphereBlue_Y: the center of rotation's Y for the blue sphere
- SphereGreen_X: the center of rotation's X for the green sphere
- SphereGreen_Y: the center of rotation's Y for the green sphere
- U: the bangs executed after an animation sequence "step" in the ActionTimer measure
- Action1: the bangs executed when the one time animation (i.e. Action1 in the ActionTimer measure) is triggered
- Action2: the bangs executed when the endless animation (i.e. Action2 in the ActionTimer measure) is triggered

Other useful info:
  • since the value of the Sgn() function is 0 for 0 and 1 for positive numbers (and adding 1 to it yields precisely the number of the animation that should be used for MeasureBinCount values), I used the (Sgn(MeasureBinCount)+1) formula in [MeasureAction] to get the animation "index" needed to be triggered
  • since MeasureAction already holds the number / index of the needed animation, it can be easily used to execute the appropriate bang sequence stored in the corresponding variables (i.e. Action1 and Action2) from the [Variables] section. Thus, with a little help from the nested variable syntax (which allows to have the name and value of a variable in another variable name), the conditional actions in [MeasureAction] can be written as [#Action[&MeasureAction]], meaning Rainmeter will choose the correct Action1 or Action2 variable ([# part means variable) based on the value of the MeasureAction measure ([& part means measure).
In other words, if MeasureBinCount is, say, 20, then:
  • the [MeasureAction] formula yields (Sgn(MeasureBinCount)+1) = (Sgn(20)+1) = (1+1) = 2
  • the [MeasureAction] will, in the conditionals handling the bin count and the triggering by mouse over, execute [#Action[&MeasureAction]] = [#Action2] = #Action2# variable, which is already appropriately declared in the [Variables] section as the desired sequence of bangs
That's pretty much it, hopefully it will be of some use - if you have any other questions, don't hesitate to ask, wihout being concerned about reading between the lines of an internet post (which can often be misleading). I'm a direct and honest guy, I say things as they are without hiding around the bush - but again, as I said, I was referring to paying attention to what has been written already (for example, "[MeasureBinCount] simulates a recycle bin count (in your code, it would be the actual recycle bin count measure)", that kind of things) and NOT to anyone's intelligence.

As always, feel free to adjust and adapt things to your preference in the above code.
Awesome sauce. Very clean and condensed code. :YESSS: :17good

Love the fact that you were able to make [Rainmeter]Update=1000 and formulate the code so the white,green,blue sphere can rotate nicely. Their rotational path is incredibly smoooooth; no hickup at all. Great point in your previous post about making image pixels smaller.

Love the added touch where each drop is associated with a sound file drop; it's much more realistic compared to how I had it. I'll have to decide if I want to add in a bubblesound as I mouseover the recyclebin. I was browsing around and found something that I may or may not want to implement -- color change depending on the total size of the recyclebin. I did it but the code probably sucks. The following was tossed in my 'old wrong code,' so if I want to use in your new awesome Animationbin.ini skin I'll have to readapt. ( Thread where I found it: https://forum.rainmeter.net/viewtopic.php?t=27381 )

I also created multiple variants of the raindrop color, and had a variable to change it if I wanted to. I might consider looking at the colormatrix code and photoshop out the inside raindrop as it's own entity so I can apply the colormatrix stuff. I tried the colormatrix example (https://docs.rainmeter.net/tips/colormatrix-guide/ ) and it basically changes the entire startbubblecolor (meaning I'll need to separate the image into two objects through photoshop so it'll work properly). so I'll have to decide how I want to approach things next. Probably a project for another day.

For the Color additives, I'll probably have to figure out how to implement the circular ball that appears with each color change into an actiontimer so that ball moves smoothly. It's herky jerky at the moment.


The raindrop on the left is from the 'bad code" with the color additives (this was done before I saw the new code). The one on right is the new awesome code by Yincognito. I'll have to decide if I want to have color additives to the new awesome code.

Code: Select all



;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
;
;		COLOR ADDITIVES - variables section
;a
;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

COLORINSIDE=GREY

Color1=Point_Grey.png
Color2=Point_Blue.png
Color3=Point_Green.png
Color4=Point_Yellow.png
Color5=Point_Orange.png
Color6=Point_Red.png
ColorSpeed=3



;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
;
;		COLOR ADDITIVES  - meters section
;
;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

[StartButton]
Meter=Button
ButtonImage=#@#Images\Startorb - ORIGINAL #COLORINSIDE#.png
SolidColor=0,0,0,1
x=15
UpdateDivider=-1

;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
;
;		COLOR ADDITIVES  - measure section
;
;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
[MeasureSize]
Measure=Plugin
Plugin=RecycleManager.dll
RecycleType=Size
Drives=All

;#GREY #1
;@ EMPTY
IfCondition=(MeasureSize = 0)
;IfTrueAction=[!SetVariable Button_Image "#@#Images\Startorb - ORIGINAL GREY.png"][!UnpauseMeasure MeasureRotateColor01][!PauseMeasure MeasureRotateColor02][!PauseMeasure MeasureRotateColor03][!PauseMeasure MeasureRotateColor04][!PauseMeasure MeasureRotateColor05][!PauseMeasure MeasureRotateColor06][!ShowMeter MeterRotateColor01][!HideMeter MeterRotateColor02][!HideMeter MeterRotateColor03][!HideMeter MeterRotateColor04][!HideMeter MeterRotateColor05][!HideMeter MeterRotateColor06]
IfTrueAction=[!SetVariable Button_Image "#@#Images\Startorb - ORIGINAL GREY.png"][!PauseMeasure MeasureRotateColor01][!PauseMeasure MeasureRotateColor02][!PauseMeasure MeasureRotateColor03][!PauseMeasure MeasureRotateColor04][!PauseMeasure MeasureRotateColor05][!PauseMeasure MeasureRotateColor06][!HideMeter MeterRotateColor01][!HideMeter MeterRotateColor02][!HideMeter MeterRotateColor03][!HideMeter MeterRotateColor04][!HideMeter MeterRotateColor05][!HideMeter MeterRotateColor06]

;#BLUE #2
;@ ANY AMOUNT in RECYCLE BIN
IfCondition2=(MeasureSize > 0) && (MeasureSize <= 134217728)
IfTrueAction2=[!SetVariable Button_Image "#@#Images\Startorb - ORIGINAL BLUE.png"][!UnpauseMeasure MeasureRotateColor02][!PauseMeasure MeasureRotateColor01][!PauseMeasure MeasureRotateColor03][!PauseMeasure MeasureRotateColor04][!PauseMeasure MeasureRotateColor05][!PauseMeasure MeasureRotateColor06][!ShowMeter MeterRotateColor02][!HideMeter MeterRotateColor01][!HideMeter MeterRotateColor03][!HideMeter MeterRotateColor04][!HideMeter MeterRotateColor05][!HideMeter MeterRotateColor06]

;#GREEN #3
;@ Quarter FULL
IfCondition3=(MeasureSize > 134217728) && (MeasureSize <= 268435456)
IfTrueAction3=[!SetVariable Button_Image "#@#Images\Startorb - ORIGINAL GREEN.png"][!UnpauseMeasure MeasureRotateColor03][!PauseMeasure MeasureRotateColor01][!PauseMeasure MeasureRotateColor02][!PauseMeasure MeasureRotateColor04][!PauseMeasure MeasureRotateColor05][!PauseMeasure MeasureRotateColor06][!ShowMeter MeterRotateColor03][!HideMeter MeterRotateColor01][!HideMeter MeterRotateColor02][!HideMeter MeterRotateColor04][!HideMeter MeterRotateColor05][!HideMeter MeterRotateColor06]
;-----@@ IfCondition3=(MeasureSize > 0) && (MeasureSize <= 268435456)


;#YELLOW #4
;@ HALF FULL
IfCondition4=(MeasureSize > 268435456) && (MeasureSize <= 536870912)
IfTrueAction4=[!SetVariable Button_Image "#@#Images\Startorb - ORIGINAL YELLOW.png"][!UnpauseMeasure MeasureRotateColor04][!PauseMeasure MeasureRotateColor01][!PauseMeasure MeasureRotateColor02][!PauseMeasure MeasureRotateColor03][!PauseMeasure MeasureRotateColor05][!PauseMeasure MeasureRotateColor06][!ShowMeter MeterRotateColor04][!HideMeter MeterRotateColor01][!HideMeter MeterRotateColor02][!HideMeter MeterRotateColor03][!HideMeter MeterRotateColor05][!HideMeter MeterRotateColor06]

;#ORANGE #5
;@ THREE QUARTERS
IfCondition5=(MeasureSize > 536870912) && (MeasureSize <= 805306368)
IfTrueAction5=[!SetVariable Button_Image "#@#Images\Startorb - ORIGINAL ORANGE.png"][!UnpauseMeasure MeasureRotateColor05][!PauseMeasure MeasureRotateColor01][!PauseMeasure MeasureRotateColor02][!PauseMeasure MeasureRotateColor03][!PauseMeasure MeasureRotateColor04][!PauseMeasure MeasureRotateColor06][!ShowMeter MeterRotateColor05][!HideMeter MeterRotateColor01][!HideMeter MeterRotateColor02][!HideMeter MeterRotateColor03][!HideMeter MeterRotateColor04][!HideMeter MeterRotateColor06]

#RED #6
;@ FULL BIN
IfCondition6=MeasureSize > 805306368
IfTrueAction6=[!SetVariable Button_Image "#@#Images\Startorb - ORIGINAL RED.png"][!UnpauseMeasure MeasureRotateColor06][!PauseMeasure MeasureRotateColor01][!PauseMeasure MeasureRotateColor02][!PauseMeasure MeasureRotateColor03][!PauseMeasure MeasureRotateColor04][!PauseMeasure MeasureRotateColor05][!ShowMeter MeterRotateColor06][!HideMeter MeterRotateColor01][!HideMeter MeterRotateColor02][!HideMeter MeterRotateColor03][!HideMeter MeterRotateColor04][!HideMeter MeterRotateColor05]
;-----@@ OnUpdateAction=[!UpdateMeter StartButton2][!Redraw]



[StartButton2]
Meter=Button
ButtonImage=#Button_Image#
SolidColor=0,0,0,1
x=15
DynamicVariables=1


User avatar
Yincognito
Posts: 2933
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: HELP: ActionTimer. Is it possible to STOP the completion of the ActionList1 on a second mouseover action?

Post by Yincognito »

strawberryshortcake wrote: October 17th, 2020, 9:11 pmI was browsing around and found something that I may or may want to implement -- color change depending on the total size of the recyclebin. I did it but the code probably sucks. The following was tossed in my 'old wrong code,' so if I want to use in your new awesome Animationbin.ini skin I'll have to readapt. ( Thread where I found it: https://forum.rainmeter.net/viewtopic.php?t=27381 )

I also created multiple variants of the raindrop color, and had a variable to change it if I wanted to. I might consider looking at the colormatrix code and photoshop out the inside raindrop as it's own entity so I can apply the colormatrix stuff. I tried the colormatrix example (https://docs.rainmeter.net/tips/colormatrix-guide/ ) and it basically changes the entire startbubblecolor, so I'll have to decide how I want to approach things next. Probably a project for another day.
Actually, that's a great idea. The visuals in the skin already look excellent and the animation and rotation makes them better, so having more colors changing based on the bin's status is going to fit well in the mix. The code doesn't suck, but it's true that it's a bit longer for my taste. But then, it's your taste that matters, as it's your skin, so you're the one deciding on it. Since we talk about colors, you might want to check the Greyscale and ImageTint options for Image meters (will work for Button meters as well, according to the manual), to recolor the button freely.

Or, you can check out this code I wrote a while ago that transitions between the desired colors, maybe there is of some use. It is "animated" through a faster update rate, but as you could see earlier, the adaptation to the AT method is possible:

Code: Select all

[Variables]
; Color Array (set it to a "<ColorNumber>:<Red>,<Green>,<Blue>,<Alpha>;" enumeration)
Colors="0:255,0,0,255;1:255,0,255,255;2:0,0,255,255;3:0,255,255,255;4:0,255,0,255;5:255,255,0,255;6:255,0,0,255;"
; Maximum Value (decrease to speed up the transition, decrease to slow it down)
Range=384
; Value's Step (decrease to slow down the transition, increase to speed it up; negative values to transition backwards)
VStep=1

[Rainmeter]
Update=25
DynamicWindowSize=1
AccurateText=1

---Measures---

[SetRGBA]
Measure=String
String=#Colors#
UpdateDivider=-1
RegExpSubstitute=1
Substitute="(?U)(.+):(.+),(.+),(.+),(.+);":"[!SetVariable R\1 \2][!SetVariable G\1 \3][!SetVariable B\1 \4][!SetVariable A\1 \5]","(\d+)(\s+\S+\])$":"\1\2[!SetVariable IdMax \1]","(?U)^(\[.+\s+(\S+)\]\[.+\s+(\S+)\]\[.+\s+(\S+)\]\[.+\s+(\S+)\])":"[!SetVariable R \2][!SetVariable G \3][!SetVariable B \4][!SetVariable A \5]\1"
OnUpdateAction=[SetRGBA]

[Value]
Group=ColorGroup
Disabled=1
Measure=Calc
Formula=((#Range#+Value+#VStep#)%#Range#)
OnUpdateAction=[!SetVariable Interval (([#Range]+1)/[#IdMax])][!SetVariable SIndex (Trunc([Value]/(([#Range]+1)/[#IdMax])))][!SetVariable EIndex (Trunc([Value]/(([#Range]+1)/[#IdMax]))+1)]
DynamicVariables=1

[Color]
Group=ColorGroup
Disabled=1
Measure=Calc
OnUpdateAction=[!SetVariable R ([#R[#SIndex]]+(([Value]-[#SIndex]*[#Interval])/[#Interval])*([#R[#EIndex]]-[#R[#SIndex]]))][!SetVariable G ([#G[#SIndex]]+(([Value]-[#SIndex]*[#Interval])/[#Interval])*([#G[#EIndex]]-[#G[#SIndex]]))][!SetVariable B ([#B[#SIndex]]+(([Value]-[#SIndex]*[#Interval])/[#Interval])*([#B[#EIndex]]-[#B[#SIndex]]))][!SetVariable A "255"][!UpdateMeter "Shape"][!Redraw]
RegExpSubstitute=1
Substitute="^.*$":"#R#,#G#,#B#,#A#","\.\d+":"","(\d+)":"  \1","[ \d]*([ \d]{3})":"\1"," ":"  "
DynamicVariables=1

---Meters---

[Shape]
Meter=Shape
Shape=Rectangle 0,0,200,100,12 | StrokeWidth 0 | Stroke Color 255,255,255,255 | Fill Color #R#,#G#,#B#,#A#
MouseScrollDownAction=[!SetVariable VStep -1][!EnableMeasureGroup ColorGroup][!UnpauseMeasureGroup ColorGroup][!UpdateMeasureGroup ColorGroup][!PauseMeasureGroup ColorGroup][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollUpAction=[!SetVariable VStep 1][!EnableMeasureGroup ColorGroup][!UnpauseMeasureGroup ColorGroup][!UpdateMeasureGroup ColorGroup][!PauseMeasureGroup ColorGroup][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
LeftMouseUpAction=[!UnpauseMeasureGroup ColorGroup][!ToggleMeasureGroup ColorGroup][!SetVariable R #R0#][!SetVariable G #G0#][!SetVariable B #B0#][!SetVariable A #A0#][!UpdateMeasureGroup ColorGroup][!UpdateMeter #CURRENTSECTION#][!Redraw]
MiddleMouseUpAction=[!TogglePauseMeasureGroup ColorGroup]
DynamicVariables=1

[Text]
Meter=STRING
X=([Shape:W]/2)r
Y=([Shape:H]/2)r
W=([Shape:W])
H=([Shape:H])
FontFace=Tahoma
FontColor=255,255,255,255
FontSize=10
FontWeight=700
AntiAlias=1
StringAlign=CenterCenter
StringEffect=Shadow
FontEffectColor=0,0,0,255
Text="TRANSITION: Color Wheel#CRLF#DIRECTION: #VStep##CRLF#COLOR: [Color]#CRLF#TRANSITION UPDATES: #Range#"
DynamicVariables=1
User avatar
strawberryshortcake
Posts: 79
Joined: August 27th, 2016, 12:49 am

Re: HELP: ActionTimer. Is it possible to STOP the completion of the ActionList1 on a second mouseover action?

Post by strawberryshortcake »

Yincognito wrote: October 17th, 2020, 9:57 pm
Actually, that's a great idea. The visuals in the skin already look excellent and the animation and rotation makes them better, so having more colors changing based on the bin's status is going to fit well in the mix. The code doesn't suck, but it's true that it's a bit longer for my taste. But then, it's your taste that matters, as it's your skin, so you're the one deciding on it. Since we talk about colors, you might want to check the Greyscale and ImageTint options for Image meters (will work for Button meters as well, according to the manual), to recolor the button freely.

Or, you can check out this code I wrote a while ago that transitions between the desired colors, maybe there is of some use. It is "animated" through a faster update rate, but as you could see earlier, the adaptation to the AT method is possible:

Code: Select all

[Variables]
; Color Array (set it to a "<ColorNumber>:<Red>,<Green>,<Blue>,<Alpha>;" enumeration)
Colors="0:255,0,0,255;1:255,0,255,255;2:0,0,255,255;3:0,255,255,255;4:0,255,0,255;5:255,255,0,255;6:255,0,0,255;"
; Maximum Value (decrease to speed up the transition, decrease to slow it down)
Range=384
; Value's Step (decrease to slow down the transition, increase to speed it up; negative values to transition backwards)
VStep=1

[Rainmeter]
Update=25
DynamicWindowSize=1
AccurateText=1

---Measures---

[SetRGBA]
Measure=String
String=#Colors#
UpdateDivider=-1
RegExpSubstitute=1
Substitute="(?U)(.+):(.+),(.+),(.+),(.+);":"[!SetVariable R\1 \2][!SetVariable G\1 \3][!SetVariable B\1 \4][!SetVariable A\1 \5]","(\d+)(\s+\S+\])$":"\1\2[!SetVariable IdMax \1]","(?U)^(\[.+\s+(\S+)\]\[.+\s+(\S+)\]\[.+\s+(\S+)\]\[.+\s+(\S+)\])":"[!SetVariable R \2][!SetVariable G \3][!SetVariable B \4][!SetVariable A \5]\1"
OnUpdateAction=[SetRGBA]

[Value]
Group=ColorGroup
Disabled=1
Measure=Calc
Formula=((#Range#+Value+#VStep#)%#Range#)
OnUpdateAction=[!SetVariable Interval (([#Range]+1)/[#IdMax])][!SetVariable SIndex (Trunc([Value]/(([#Range]+1)/[#IdMax])))][!SetVariable EIndex (Trunc([Value]/(([#Range]+1)/[#IdMax]))+1)]
DynamicVariables=1

[Color]
Group=ColorGroup
Disabled=1
Measure=Calc
OnUpdateAction=[!SetVariable R ([#R[#SIndex]]+(([Value]-[#SIndex]*[#Interval])/[#Interval])*([#R[#EIndex]]-[#R[#SIndex]]))][!SetVariable G ([#G[#SIndex]]+(([Value]-[#SIndex]*[#Interval])/[#Interval])*([#G[#EIndex]]-[#G[#SIndex]]))][!SetVariable B ([#B[#SIndex]]+(([Value]-[#SIndex]*[#Interval])/[#Interval])*([#B[#EIndex]]-[#B[#SIndex]]))][!SetVariable A "255"][!UpdateMeter "Shape"][!Redraw]
RegExpSubstitute=1
Substitute="^.*$":"#R#,#G#,#B#,#A#","\.\d+":"","(\d+)":"  \1","[ \d]*([ \d]{3})":"\1"," ":"  "
DynamicVariables=1

---Meters---

[Shape]
Meter=Shape
Shape=Rectangle 0,0,200,100,12 | StrokeWidth 0 | Stroke Color 255,255,255,255 | Fill Color #R#,#G#,#B#,#A#
MouseScrollDownAction=[!SetVariable VStep -1][!EnableMeasureGroup ColorGroup][!UnpauseMeasureGroup ColorGroup][!UpdateMeasureGroup ColorGroup][!PauseMeasureGroup ColorGroup][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
MouseScrollUpAction=[!SetVariable VStep 1][!EnableMeasureGroup ColorGroup][!UnpauseMeasureGroup ColorGroup][!UpdateMeasureGroup ColorGroup][!PauseMeasureGroup ColorGroup][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
LeftMouseUpAction=[!UnpauseMeasureGroup ColorGroup][!ToggleMeasureGroup ColorGroup][!SetVariable R #R0#][!SetVariable G #G0#][!SetVariable B #B0#][!SetVariable A #A0#][!UpdateMeasureGroup ColorGroup][!UpdateMeter #CURRENTSECTION#][!Redraw]
MiddleMouseUpAction=[!TogglePauseMeasureGroup ColorGroup]
DynamicVariables=1

[Text]
Meter=STRING
X=([Shape:W]/2)r
Y=([Shape:H]/2)r
W=([Shape:W])
H=([Shape:H])
FontFace=Tahoma
FontColor=255,255,255,255
FontSize=10
FontWeight=700
AntiAlias=1
StringAlign=CenterCenter
StringEffect=Shadow
FontEffectColor=0,0,0,255
Text="TRANSITION: Color Wheel#CRLF#DIRECTION: #VStep##CRLF#COLOR: [Color]#CRLF#TRANSITION UPDATES: #Range#"
DynamicVariables=1
I'll definitely have to look/and probably implement your transition code; I like the 'transition' implementation.
adds playing the sound (had to find one online, as it wasn't included in the 2 packages I had at my disposal) on every raindrop, based on the moment when the raindrop falls, so now, as long as one raindrop means 12 frames, you can either decrease or increase the frame count (assuming the images exist) to have less or more raindrops and the sound will play for as many raindrops as there are in total (this is true for the endless animation as well: every raindrop will generate a sound; this can of course be adjusted, to limit on how many raindrops the sound is desired, let me know if you want to)
Concern 1:
Yes, see if you could modify it so there's a variable that can be adjusted so the sound stops after a certain period of time while allowing further raindrops to keep falling (with no sound) when the trashcan is still full.

However, do have a default value where I can revert back to the default state (just like how the code has it now) where the sound continues to play with every single raindrop. I'm guessing all this should apply only to the FULL trashcan because every other state works perfectly fine as is.

Concern 2
What does colon : mean in rainmeter? Does colon mean something along the lines of an apostrophe?
Is it the same as button's "X" and button's "W"? If so, why isn't the first just written like: New_X=X((X)+(w)+15) or something like that?

Code: Select all

SphereGreen_X=([MeterStartButton:X]+[MeterStartButton:W]/2)
X=([button:X]+[button:W]+15)
Y=(([#w_[&measureSTYLE]]/2)+5)

---the following is from some other code
W=([button:W])
X=([button:X]+1)
Y=([button:Y]+1)


Concern 3
Just for clarification sake.
(1) ActionTimer curisioty....
A: ActionList1: corresponds the raindrop (single execute 1), slide represents both raindrop and spheres
B: ActionList2: corresponds to raindrop (continuous loop animation, execute 2) and slide represents the raindrop and colored (white,green,blue spheres)
C: Reset: corresponds to the raindrop, resetting the frame back to zero
D: Slide: corresponds to the raindrop, BUT also the movement pattern of the (white/green/blue) spheres
E: Rerun: reruns the raindrops in an endless loop.

Code: Select all

[MeasureSlider]
Measure=Plugin
Plugin=ActionTimer
(A) ActionList1=Reset | Wait #Speed# | Repeat Slide,#Speed#,#FrameCount# | Wait #Speed#
(B) ActionList2=Repeat Slide,#Speed#,#FrameCount# | Wait #Speed# | Rerun | Wait #Speed#
(C) Reset=[!SetVariable Frame 0]#U#
(D) Slide=[!SetVariable Frame ((#Frame#+1)%#FrameCount#)][!SetVariable SpheresAngle ((#SpheresAngle#+#SpheresAngleIncrement#)%360)]#U#
(E) Rerun=[!CommandMeasure MeasureSlider "Stop 1"][!CommandMeasure MeasureSlider "Stop 2"][!CommandMeasure MeasureSlider "Execute 2"]
UpdateDivider=-1
DynamicVariables=1
(2) Hypothetically, if there are 10 separate animations, would it then be written like the code below:

Code: Select all

[MeasureSlider]
Measure=Plugin
Plugin=ActionTimer
ActionList1
ActionList2=Repeat JUMP | Wait 5 Repeat KICK | Wait 5 Repeat TOSS | Wait 10 Repeat FALL
ActionList3=Reset | Wait 5 | Repeat KICK,#Speed#, #FrameCount# | Wait #Speed# | Repeat JUMP, #Speed
ActionList4=Reset | Wait #Speed# | Repeat Slide,#Speed#,#FrameCount# | Wait #Speed#
ActionList5=Repeat THROW | Reset | Wait 2 | Repeat FALL
ActionList6=Repeat FALL,#Speed#,#FrameCount# | Wait #Speed# | Rerun | Wait #Speed#
Reset=
Slide=
Rerun=
LetItGo=
JUMP=
PUNCH=
KICK=
TOSS=
THROW=
FALL=
FIRE=
SWIM=
GALLOP=
ELBOW_DROP=
UpdateDivier=-1
DynamicVariables=1
Concern 4:
Would you ever write multiple ActionTimers like such:

Code: Select all

[MeasureSlider01]
Measure=Plugin
Plugin=ActionTimer
ActionList1

[MeasureSlider02]
Measure=Plugin
Plugin=ActionTimer
ActionList1

[MeasureSlider03]
Measure=Plugin
Plugin=ActionTimer
ActionList1

[MeasureSlider04]
Measure=Plugin
Plugin=ActionTimer
ActionList3
ActionList4
User avatar
Yincognito
Posts: 2933
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: HELP: ActionTimer. Is it possible to STOP the completion of the ActionList1 on a second mouseover action?

Post by Yincognito »

Concern 1:
Done. You have to:
  • add a Cycle=0 in the [Variables] section (this will be the number of the cycle where the raindrop animation is currently at; I added it just before Frame, since they're more or less related)
  • add a [!SetVariable Cycle 0] at the start of both Action1 and Action2 variables from the [Variables] section (as it can be easily deduced, this will reset the cycle counting to 0 when each animation starts)
  • add a && (#Cycle#<3) (&& stands for logical AND, and is preceded by a space) at the end of the IfCondition in [MeasurePlay] (since the cycle counting starts at 0, the above means that the skin will play 3 raindrop sounds, i.e. for cycle 0, cycle 1 and cycle 2; obviously, you can have other numbers than 3 there; if you want to revert to the free behavior earlier, simply change this part to && (#Cycle#>=0), or place the part on a subsequent line and temporarily comment it, as I don't think yet another variable is really necessary for reverting to happen, especially when it's equally easy to revert it this way)
  • finally, add a [!SetVariable Cycle (#Cycle#+1)] at the start of the IfTrueAction in the same [MeasurePlay] (this will increment the cycle on each occurence of a raindrop sound)
Concern 2 & 3:
I liked your mix of sports in Concern 2 (chuckled a bit trying to understand what the heck was going on there and which punch won that contest, LOL), but if I understood it correctly, in both these "concerns", you're asking how to better write separate animations in AT measure(s). First of all, like I said, I would try to avoid like the plague having multiple AT animations happening at the same time, in an intertwined fashion, because the increased number !Redraw bangs will increase the CPU usage, the possibility of some stutter on intensive animations, it will be harder to make a connection between variable values across animations, etc. Having multiple AT animations happening at different times is ok though (and any permitted syntax is ok there, see the example at the bottom of the page here), just like merging/integrating animations together (like I did with the spheres).

That being said, if by any chance you're talking about coloring the orb differently based on some variable or measure value, I don't think you need to overcomplicate things by looking for an AT animation or even my color transition code, as stuff like this can be made relatively easy without. A simplified example:
  • add:

    Code: Select all

    OrbTint0=0,255,0,255
    OrbTint1=255,255,0,255
    OrbTint2=255,0,0,255
    OrbTint3=0,255,0,255
    
    to the [Variables] section (these are the classic progress colors of green - low, yellow - medium, red - high, then return to green)
  • add [!UpdateMeter MeterStartButton] before [!UpdateMeter MeterRaindrops] in the U variable from the [Variables] section (i.e. we need to update the meter when we change colors; the redraw is already there, so no need to add anything else)
  • add:

    Code: Select all

    Greyscale=1
    ImageTint=[#OrbTint[#Cycle]]
    
    before UpdateDivider=-1 in [MeterStartButton], and also add DynamicVariables=1 at the end of the meter (this will first greyscale the orb so we can recolor it, then recolor it with the #OrbTint0# to #OrbTint3# variables above, based on the value of #Cycle# - remember the nested variable syntax I talked about in my previous posts)
Then, watch how nice the orb is changing colors on each raindrop. 8-) Sure, there are only 4 colors, but this can be adjusted further, if needed, and even made to "restart" the same sequence of colors by calculating somewhere the % aka modulo between #Cycle# and a desired "count-like" number, and using that result instead of plain #Cycle# in the nested syntax above. It can also be based quite easily on the recycle bin count or recycle bin size, given a carefully designed formula. Math (and by extension, formuas) can produce great visuals, and fractals are the best example of this.
If somehow you didn't manage to follow the steps above precisely, here's the full code (limited raindrop sounds + recoloring the orb based on raindrop cycle):

Code: Select all

[Variables]
TriggerSlide=0
Cycle=0
Frame=0
FrameCount=48
SpheresAngle=0
SpheresAngleIncrement=3
Speed=75
BinIconSize=32
BinIconEmpty=#@#BinEmpty.png
BinIconFull=#@#BinFull.png
OrbTint0=0,255,0,255
OrbTint1=255,255,0,255
OrbTint2=255,0,0,255
OrbTint3=0,255,0,255
SphereSize=25
SphereRotationRadius=22
SphereWhite_X=([MeterStartButton:X]+[MeterStartButton:W]/2-20)
SphereWhite_Y=(#SphereSize#/2+#SphereRotationRadius#+10)
SphereBlue_X=([MeterStartButton:X]+[MeterStartButton:W]/2+20)
SphereBlue_Y=(#SphereSize#/2+#SphereRotationRadius#+10)
SphereGreen_X=([MeterStartButton:X]+[MeterStartButton:W]/2)
SphereGreen_Y=(#SphereSize#/2+#SphereRotationRadius#)
U=[!UpdateMeasure MeasurePlay][!UpdateMeasure MeasureSlider][!UpdateMeasure MeasureSpheresAngle][!UpdateMeter MeterStartButton][!UpdateMeter MeterRaindrops][!UpdateMeterGroup SpheresGroup][!Redraw]
Action1=[!SetVariable Cycle 0][!ShowMeter MeterBinIconEmpty][!HideMeter MeterBinIconFull][!HideMeter MeterBinCount][!HideMeter MeterSphereGreen][!HideMeter MeterSphereWhite][!HideMeter MeterSphereBlue][!CommandMeasure MeasureSlider "Stop 1"][!CommandMeasure MeasureSlider "Stop 2"][!CommandMeasure MeasureSlider "Execute 1"]
Action2=[!SetVariable Cycle 0][!HideMeter MeterBinIconEmpty][!ShowMeter MeterBinIconFull][!ShowMeter MeterBinCount][!ShowMeter MeterSphereGreen][!ShowMeter MeterSphereWhite][!ShowMeter MeterSphereBlue][!CommandMeasure MeasureSlider "Stop 1"][!CommandMeasure MeasureSlider "Stop 2"][!CommandMeasure MeasureSlider "Execute 2"]

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=0,0,0,1

---Measures---

[MeasurePlay]
Measure=Calc
UpdateDivider=-1
IfCondition=(#Frame#%12=8) && (#Cycle#<3)
IfTrueAction=[!SetVariable Cycle (#Cycle#+1)][Play "#@#WaterDrop.wav"]
IfConditionMode=1
DynamicVariables=1

[MeasureSlider]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Reset | Wait #Speed# | Repeat Slide,#Speed#,#FrameCount# | Wait #Speed#
ActionList2=Repeat Slide,#Speed#,#FrameCount# | Wait #Speed# | Rerun | Wait #Speed#
Reset=[!SetVariable Frame 0]#U#
Slide=[!SetVariable Frame ((#Frame#+1)%#FrameCount#)][!SetVariable SpheresAngle ((#SpheresAngle#+#SpheresAngleIncrement#)%360)]#U#
Rerun=[!CommandMeasure MeasureSlider "Stop 1"][!CommandMeasure MeasureSlider "Stop 2"][!CommandMeasure MeasureSlider "Execute 2"]
UpdateDivider=-1
DynamicVariables=1

[MeasureBinCount]
Group=RecycleGroup
Measure=RecycleManager
RecycleType=Count

[MeasureBinSize]
Group=RecycleGroup
Measure=RecycleManager
RecycleType=Size

[MeasureAction]
Measure=Calc
Formula=(Sgn(MeasureBinCount)+1)
IfCondition=(MeasureBinCount=0)
IfTrueAction=[#Action[&MeasureAction]]
IfFalseAction=[#Action[&MeasureAction]]
IfCondition2=(#TriggerSlide#=1)
IfTrueAction2=[#Action[&MeasureAction]]
DynamicVariables=1

[MeasureSpheresAngle]
Measure=Calc
Formula=#SpheresAngle#
MinValue=0
MaxValue=360
UpdateDivider=-1
DynamicVariables=1

---Styles---

[Style]
StringAlign=Right
FontFace=Roboto
FontSize=9
FontColor=255,255,255,255
AntiAlias=1

---Meters---

[MeterStartButton]
Meter=Button
ButtonImage=#@#StartOrbGreen.png
X=15
AntiAlias=1
Greyscale=1
ImageTint=[#OrbTint[#Cycle]]
UpdateDivider=-1
MouseOverAction=[!SetVariable TriggerSlide 1][!ShowMeter MeterBinSize][Play "#@#WaterDrip.wav"][!UpdateMeasure MeasureAction]
MouseLeaveAction=[!SetVariable TriggerSlide 0][!HideMeter MeterBinSize][!Redraw]
LeftMouseUpAction=[Play "#@#WaterFlush.wav"][!CommandMeasure MeasureBinCount "OpenBin"]
RightMouseUpAction=[Play "#@#WaterFlush.wav"][!CommandMeasure MeasureBinCount "EmptyBin"][!UpdateMeasureGroup RecycleGroup][!UpdateMeasure MeasureAction]
DynamicVariables=1

[MeterRaindrops]
Meter=Image
ImageName=#@#Raindrop-#Frame#.png
UpdateDivider=-1
DynamicVariables=1

[MeterBinIconEmpty]
Meter=Image
X=10
Y=20
W=#BinIconSize#
ImageName=#BinIconEmpty#
AntiAlias=1
UpdateDivider=-1

[MeterBinIconFull]
Meter=Image
X=10
Y=20
W=#BinIconSize#
ImageName=#BinIconFull#
AntiAlias=1
UpdateDivider=-1

[MeterBinSize]
Hidden=1
Meter=String
MeterStyle=Style
X=55
Y=0
AutoScale=1
NumOfDecimals=1
MeasureName=MeasureBinSize
Text=%1B

[MeterBinCount]
Meter=String
MeterStyle=Style
X=0r
Y=13r
MeasureName=MeasureBinCount
Text=%1 file

[MeterSphereGreen]
Group=SpheresGroup
Meter=Rotator
X=#SphereGreen_X#
Y=#SphereGreen_Y#
ImageName=#@#SphereGreen.png
StartAngle=(-PI/2)
RotationAngle=(PI*2)
OffsetX=(-(#SphereRotationRadius#-#SphereSize#/2))
OffsetY=(#SphereSize#/2)
MeasureName=MeasureSpheresAngle
UpdateDivider=-1

[MeterSphereWhite]
Group=SpheresGroup
Meter=Rotator
X=#SphereWhite_X#
Y=#SphereWhite_Y#
ImageName=#@#SphereWhite.png
StartAngle=(-PI/2+PI/3)
RotationAngle=(-PI*2)
OffsetX=(-(#SphereRotationRadius#-#SphereSize#/2))
OffsetY=(#SphereSize#/2)
MeasureName=MeasureSpheresAngle
UpdateDivider=-1

[MeterSphereBlue]
Group=SpheresGroup
Meter=Rotator
X=#SphereBlue_X#
Y=#SphereBlue_Y#
ImageName=#@#SphereBlue.png
StartAngle=(-PI/2-PI/3)
RotationAngle=(PI*2)
OffsetX=(-(#SphereRotationRadius#-#SphereSize#/2))
OffsetY=(#SphereSize#/2)
MeasureName=MeasureSpheresAngle
UpdateDivider=-1
P.S. Me specifying the exact place where to add a certain thing (even to the level of within a section) has no particular meaning, other than keeping the codes synchronized for us - although in some cases might be important, like, say, the order of bangs in an action.
User avatar
strawberryshortcake
Posts: 79
Joined: August 27th, 2016, 12:49 am

Re: HELP: ActionTimer. Is it possible to STOP the completion of the ActionList1 on a second mouseover action?

Post by strawberryshortcake »

Yincognito wrote: October 18th, 2020, 2:47 am
Concern 1:
Done. You have to:
  • add a Cycle=0 in the [Variables] section (this will be the number of the cycle where the raindrop animation is currently at; I added it just before Frame, since they're more or less related)
  • add a [!SetVariable Cycle 0] at the start of both Action1 and Action2 variables from the [Variables] section (as it can be easily deduced, this will reset the cycle counting to 0 when each animation starts)
  • add a && (#Cycle#<3) (&& stands for logical AND, and is preceded by a space) at the end of the IfCondition in [MeasurePlay] (since the cycle counting starts at 0, the above means that the skin will play 3 raindrop sounds, i.e. for cycle 0, cycle 1 and cycle 2; obviously, you can have other numbers than 3 there; if you want to revert to the free behavior earlier, simply change this part to && (#Cycle#>=0), or place the part on a subsequent line and temporarily comment it, as I don't think yet another variable is really necessary for reverting to happen, especially when it's equally easy to revert it this way)
  • finally, add a [!SetVariable Cycle (#Cycle#+1)] at the start of the IfTrueAction in the same [MeasurePlay] (this will increment the cycle on each occurence of a raindrop sound)
Concern 2 & 3:
I liked your mix of sports in Concern 2 (chuckled a bit trying to understand what the heck was going on there and which punch won that contest, LOL), but if I understood it correctly, in both these "concerns", you're asking how to better write separate animations in AT measure(s). First of all, like I said, I would try to avoid like the plague having multiple AT animations happening at the same time, in an intertwined fashion, because the increased number !Redraw bangs will increase the CPU usage, the possibility of some stutter on intensive animations, it will be harder to make a connection between variable values across animations, etc. Having multiple AT animations happening at different times is ok though (and any permitted syntax is ok there, see the example at the bottom of the page here), just like merging/integrating animations together (like I did with the spheres).

That being said, if by any chance you're talking about coloring the orb differently based on some variable or measure value, I don't think you need to overcomplicate things by looking for an AT animation or even my color transition code, as stuff like this can be made relatively easy without. A simplified example:
  • add:

    Code: Select all

    OrbTint0=0,255,0,255
    OrbTint1=255,255,0,255
    OrbTint2=255,0,0,255
    OrbTint3=0,255,0,255
    
    to the [Variables] section (these are the classic progress colors of green - low, yellow - medium, red - high, then return to green)
  • add [!UpdateMeter MeterStartButton] before [!UpdateMeter MeterRaindrops] in the U variable from the [Variables] section (i.e. we need to update the meter when we change colors; the redraw is already there, so no need to add anything else)
  • add:

    Code: Select all

    Greyscale=1
    ImageTint=[#OrbTint[#Cycle]]
    
    before UpdateDivider=-1 in [MeterStartButton], and also add DynamicVariables=1 at the end of the meter (this will first greyscale the orb so we can recolor it, then recolor it with the #OrbTint0# to #OrbTint3# variables above, based on the value of #Cycle# - remember the nested variable syntax I talked about in my previous posts)
Then, watch how nice the orb is changing colors on each raindrop. 8-) Sure, there are only 4 colors, but this can be adjusted further, if needed, and even made to "restart" the same sequence of colors by calculating somewhere the % aka modulo between #Cycle# and a desired "count-like" number, and using that result instead of plain #Cycle# in the nested syntax above. It can also be based quite easily on the recycle bin count or recycle bin size, given a carefully designed formula. Math (and by extension, formuas) can produce great visuals, and fractals are the best example of this.

If somehow you didn't manage to follow the steps above precisely, here's the full code (limited raindrop sounds + recoloring the orb based on raindrop cycle):

Code: Select all

[Variables]
TriggerSlide=0
Cycle=0
Frame=0
FrameCount=48
SpheresAngle=0
SpheresAngleIncrement=3
Speed=75
BinIconSize=32
BinIconEmpty=#@#BinEmpty.png
BinIconFull=#@#BinFull.png
OrbTint0=0,255,0,255
OrbTint1=255,255,0,255
OrbTint2=255,0,0,255
OrbTint3=0,255,0,255
SphereSize=25
SphereRotationRadius=22
SphereWhite_X=([MeterStartButton:X]+[MeterStartButton:W]/2-20)
SphereWhite_Y=(#SphereSize#/2+#SphereRotationRadius#+10)
SphereBlue_X=([MeterStartButton:X]+[MeterStartButton:W]/2+20)
SphereBlue_Y=(#SphereSize#/2+#SphereRotationRadius#+10)
SphereGreen_X=([MeterStartButton:X]+[MeterStartButton:W]/2)
SphereGreen_Y=(#SphereSize#/2+#SphereRotationRadius#)
U=[!UpdateMeasure MeasurePlay][!UpdateMeasure MeasureSlider][!UpdateMeasure MeasureSpheresAngle][!UpdateMeter MeterStartButton][!UpdateMeter MeterRaindrops][!UpdateMeterGroup SpheresGroup][!Redraw]
Action1=[!SetVariable Cycle 0][!ShowMeter MeterBinIconEmpty][!HideMeter MeterBinIconFull][!HideMeter MeterBinCount][!HideMeter MeterSphereGreen][!HideMeter MeterSphereWhite][!HideMeter MeterSphereBlue][!CommandMeasure MeasureSlider "Stop 1"][!CommandMeasure MeasureSlider "Stop 2"][!CommandMeasure MeasureSlider "Execute 1"]
Action2=[!SetVariable Cycle 0][!HideMeter MeterBinIconEmpty][!ShowMeter MeterBinIconFull][!ShowMeter MeterBinCount][!ShowMeter MeterSphereGreen][!ShowMeter MeterSphereWhite][!ShowMeter MeterSphereBlue][!CommandMeasure MeasureSlider "Stop 1"][!CommandMeasure MeasureSlider "Stop 2"][!CommandMeasure MeasureSlider "Execute 2"]

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=0,0,0,1

---Measures---

[MeasurePlay]
Measure=Calc
UpdateDivider=-1
IfCondition=(#Frame#%12=8) && (#Cycle#<3)
IfTrueAction=[!SetVariable Cycle (#Cycle#+1)][Play "#@#WaterDrop.wav"]
IfConditionMode=1
DynamicVariables=1

[MeasureSlider]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Reset | Wait #Speed# | Repeat Slide,#Speed#,#FrameCount# | Wait #Speed#
ActionList2=Repeat Slide,#Speed#,#FrameCount# | Wait #Speed# | Rerun | Wait #Speed#
Reset=[!SetVariable Frame 0]#U#
Slide=[!SetVariable Frame ((#Frame#+1)%#FrameCount#)][!SetVariable SpheresAngle ((#SpheresAngle#+#SpheresAngleIncrement#)%360)]#U#
Rerun=[!CommandMeasure MeasureSlider "Stop 1"][!CommandMeasure MeasureSlider "Stop 2"][!CommandMeasure MeasureSlider "Execute 2"]
UpdateDivider=-1
DynamicVariables=1

[MeasureBinCount]
Group=RecycleGroup
Measure=RecycleManager
RecycleType=Count

[MeasureBinSize]
Group=RecycleGroup
Measure=RecycleManager
RecycleType=Size

[MeasureAction]
Measure=Calc
Formula=(Sgn(MeasureBinCount)+1)
IfCondition=(MeasureBinCount=0)
IfTrueAction=[#Action[&MeasureAction]]
IfFalseAction=[#Action[&MeasureAction]]
IfCondition2=(#TriggerSlide#=1)
IfTrueAction2=[#Action[&MeasureAction]]
DynamicVariables=1

[MeasureSpheresAngle]
Measure=Calc
Formula=#SpheresAngle#
MinValue=0
MaxValue=360
UpdateDivider=-1
DynamicVariables=1

---Styles---

[Style]
StringAlign=Right
FontFace=Roboto
FontSize=9
FontColor=255,255,255,255
AntiAlias=1

---Meters---

[MeterStartButton]
Meter=Button
ButtonImage=#@#StartOrbGreen.png
X=15
AntiAlias=1
Greyscale=1
ImageTint=[#OrbTint[#Cycle]]
UpdateDivider=-1
MouseOverAction=[!SetVariable TriggerSlide 1][!ShowMeter MeterBinSize][Play "#@#WaterDrip.wav"][!UpdateMeasure MeasureAction]
MouseLeaveAction=[!SetVariable TriggerSlide 0][!HideMeter MeterBinSize][!Redraw]
LeftMouseUpAction=[Play "#@#WaterFlush.wav"][!CommandMeasure MeasureBinCount "OpenBin"]
RightMouseUpAction=[Play "#@#WaterFlush.wav"][!CommandMeasure MeasureBinCount "EmptyBin"][!UpdateMeasureGroup RecycleGroup][!UpdateMeasure MeasureAction]
DynamicVariables=1

[MeterRaindrops]
Meter=Image
ImageName=#@#Raindrop-#Frame#.png
UpdateDivider=-1
DynamicVariables=1

[MeterBinIconEmpty]
Meter=Image
X=10
Y=20
W=#BinIconSize#
ImageName=#BinIconEmpty#
AntiAlias=1
UpdateDivider=-1

[MeterBinIconFull]
Meter=Image
X=10
Y=20
W=#BinIconSize#
ImageName=#BinIconFull#
AntiAlias=1
UpdateDivider=-1

[MeterBinSize]
Hidden=1
Meter=String
MeterStyle=Style
X=55
Y=0
AutoScale=1
NumOfDecimals=1
MeasureName=MeasureBinSize
Text=%1B

[MeterBinCount]
Meter=String
MeterStyle=Style
X=0r
Y=13r
MeasureName=MeasureBinCount
Text=%1 file

[MeterSphereGreen]
Group=SpheresGroup
Meter=Rotator
X=#SphereGreen_X#
Y=#SphereGreen_Y#
ImageName=#@#SphereGreen.png
StartAngle=(-PI/2)
RotationAngle=(PI*2)
OffsetX=(-(#SphereRotationRadius#-#SphereSize#/2))
OffsetY=(#SphereSize#/2)
MeasureName=MeasureSpheresAngle
UpdateDivider=-1

[MeterSphereWhite]
Group=SpheresGroup
Meter=Rotator
X=#SphereWhite_X#
Y=#SphereWhite_Y#
ImageName=#@#SphereWhite.png
StartAngle=(-PI/2+PI/3)
RotationAngle=(-PI*2)
OffsetX=(-(#SphereRotationRadius#-#SphereSize#/2))
OffsetY=(#SphereSize#/2)
MeasureName=MeasureSpheresAngle
UpdateDivider=-1

[MeterSphereBlue]
Group=SpheresGroup
Meter=Rotator
X=#SphereBlue_X#
Y=#SphereBlue_Y#
ImageName=#@#SphereBlue.png
StartAngle=(-PI/2-PI/3)
RotationAngle=(PI*2)
OffsetX=(-(#SphereRotationRadius#-#SphereSize#/2))
OffsetY=(#SphereSize#/2)
MeasureName=MeasureSpheresAngle
UpdateDivider=-1
P.S. Me specifying the exact place where to add a certain thing (even to the level of within a section) has no particular meaning, other than keeping the codes synchronized for us - although in some cases might be important, like, say, the order of bangs in an action.
Incredible work as usual. Your username fits you well. You're like a superstar coding genius.


PART A:
Yes, (i.e. :D KICK, THROW PUNCH, etc.) I simply want to know how to wrap my head around writing ActionTimer's properly when there are multiple animations involved. Hypothetically, if there's a powerful enough computer, and hypothetically, you wanted 3 or more animations simultaneously, or sequentially, etc.

PART B
The first part allowing me to change the sound file duration was great, as well having the default constant raindrop sound during a full trashbin. Perfect.

Part C
I know you mentioned that it was a simple example that you created. I think the color change probably works better in a different situation (that I might think of in the future.) I still love seeing the color change with every raindrop (very interesting and fun, groovy) however, I might remove that effect and try to adapt it for Recycle Bin Size instead. You said the math should be easy.

I think it has more value if color is used as an indicator of Recycle bin size. Another person who might see this thread in the future and be interested in using color code to determine recycle bin item count, but to me, size is probably more important (that's what she said) because you can have 100 pieces of 1mb pictures in ( = 100mb) but a single 3 GB video will completely 'saturate' (overwhelm???) the recycle bin.

These are just placeholder numbers. Fiddle with the number however you like, but allowing the user to customize those numbers would be fantastic. (I'm not sure if those are the correct color spectrum order. Adjust it to what's actually correct.)

MeasureBinSize > 2 GB = RED
MeasureBinSize > 1.5 GB = PURPLE
MeasureBinSize > 1.0 GB (1000MB) = ORANGE
MeasureBinSize >512 MB = YELLOW
MeasureBinSize > 256MB = GREEN
MeasureBinSize > 0kb = BLUE
MeasureBinSize = 0 kb = GREY

P.S. You specifying where things go (and not having a real meaning) ... but it does help a beginner see it from a real coder's point of view. Also why something goes where and why really helps a beginner to start to understand. Really helpful.