It is currently March 29th, 2024, 3:09 pm

Interrupt a !bang?

Get help with creating, editing & fixing problems with skins
User avatar
Cariboudjan
Posts: 264
Joined: May 12th, 2019, 8:55 am

Interrupt a !bang?

Post by Cariboudjan »

Skin uses Update=-1 (so using a counting measure or formula isn't possible). I'd like to know if there is a clever way to use a series of [!Delay 1000] bangs, and interrupt the series of bangs if necessary. For example,

MouseOverAction=[!Delay 1000][!Delay 1000][!Delay 1000][!ActivateConfig ...]
MouseLeaveAction=[Stop/Interrupt above bangs somehow...]

So that what I'd have is effectively a timer that performs an action when it reaches 3 seconds, but also can be interrupted if my mouse leaves the meter, or some other trigger, without needing to update the skin or have any special timer measure.

This is what I've tried to make so far, but doesn't work:

Code: Select all

[Rainmeter]
Update=-1

[Variables]

[Meter]
Meter=Image
SolidColor=255,55,55
W=50
H=50
MouseOverAction=[!EnableMeasure Timer][!UpdateMeasure Timer]
MouseLeaveAction=[!DisableMeasure Timer][!UpdateMeasure Timer]

[Timer]
Measure=Calc
IfCondition=1=1
IfTrueAction=[!Delay 1000][!Delay 1000][!Delay 1000][!Hide]
Disabled=1
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Interrupt a !bang?

Post by eclectic-tech »

This may work for you... :)

Code: Select all

; ========= Metadata ==========
[Metadata]
Name=
Author=
Information=
; BY=attribution / SA=share-alike / ND=no-derivatives / NC=non-commercial
License=CC BY-SA-NC 3.0
Version=

; ========= Variables ==========
[Variables]
MyCount=0

; ========= Skin Settings ==========
[Rainmeter]
Update=-1
AccurateText=1
DynamicWindowSize=1
Group=#RootConfig#

; ========= Measures ==========
[MeasureCalc]
Measure=Calc
Formula=(#MyCount#+1)%2
DynamicVariables=1
IfCondition=#MyCount#=0
IfTrueAction=[!Log "BANG! You're dead!"]
IfConditionMode=1
Paused=1

; ========= Meter Styles ==========



; ========= Meters ==========
[MeterString]
Meter=String
SolidColor=255,255,255,100
Padding=20,10,20,10
FontSize=14
Text=HOVER FOR 3 SECS
MouseOverAction=[!UnpauseMeasure MeasureCalc][!Delay 3000][!UpdateMeasure MeasureCalc]
MouseLeaveAction=[!PauseMeasure MeasureCalc][!SetVariable MyCount 0]
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Interrupt a !bang?

Post by balala »

Sorry eclectic-tech, you was quicker than me. Again!
Cariboudjan wrote: January 5th, 2020, 6:34 pm Skin uses Update=-1 (so using a counting measure or formula isn't possible). I'd like to know if there is a clever way to use a series of [!Delay 1000] bangs, and interrupt the series of bangs if necessary. For example,

MouseOverAction=[!Delay 1000][!Delay 1000][!Delay 1000][!ActivateConfig ...]
MouseLeaveAction=[Stop/Interrupt above bangs somehow...]

So that what I'd have is effectively a timer that performs an action when it reaches 3 seconds, but also can be interrupted if my mouse leaves the meter, or some other trigger, without needing to update the skin or have any special timer measure.
The !Delay bang works even if the Update of the skin is set to -1, so using the MouseOverAction=[!Delay 1000][!Delay 1000][!Delay 1000][!ActivateConfig ...] option will let you to activate the appropriate skin after three seconds when you're hovering the mouse over the meter / skin. What I don't understand on the other hand is why are you using three !Delay bangs, why one isn't enough (MouseOverAction=[!Delay 3000][!ActivateConfig ...]).
However if you're using !Delay bang(s), is it not possible to interrupt it / them. Once you've hovered the mouse over the meter where the above MouseOverAction is added, the appropriate skin will be anyway activated after the delay (second sentence of the Note here).
I think if you wanna make possible to interrupt it, you have to use ActionTimer plugin measures. That one can be easily interrupted.
Cariboudjan wrote: January 5th, 2020, 6:34 pm This is what I've tried to make so far, but doesn't work:
But this code works perfectly. What it does is that if you're hovering the mouse over the meter the skin is hidden after three seconds. Even if you're leaving the meter, the skin is hidden after three seconds, because once the option executed, the !Delay bangs can't be interrupted:
GIF.gif
What do you mean by "doesn't work"?
You do not have the required permissions to view the files attached to this post.
User avatar
Cariboudjan
Posts: 264
Joined: May 12th, 2019, 8:55 am

Re: Interrupt a !bang?

Post by Cariboudjan »

Balala, it doesn't work in terms of it doesn't do what I wanted it to do (Not [!Hide] on MouseLeaveAction)

Thank a lot Eclectic. I might find a way to make this work.

By the way, Balala, what program do you use to make gifs like that?
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Interrupt a !bang?

Post by eclectic-tech »

Cariboudjan wrote: January 6th, 2020, 12:22 am Balala, it doesn't work in terms of it doesn't do what I wanted it to do (Not [!Hide] on MouseLeaveAction)

Thank a lot Eclectic. I might find a way to make this work.

By the way, Balala, what program do you use to make gifs like that?
Aside: I use GifCam to generate animations in post.

As balala stated, you can not interrupt a bang, it is going to complete the action once it starts... but you can unpause/pause a measure and thereby prevent it executing an IfCondition statement.

My code uses a paused calc measure that "toggles" (starts at 1 and changes to zero when updated), and uses that change to fire any bang(s) you want. The mouseover will unpause the measure, and wait 3 seconds before updating it. However, if the mouse leaves before the delay is over, the leave action pauses the measure and sets the control variable #MyCount# back to it's initial value, so the IfCondition is not resolved.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Interrupt a !bang?

Post by mak_kawa »

Aside too: For the motion capture of PC screen, I use ScreenToGif. Really intuitive and functional software.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Interrupt a !bang?

Post by jsmorley »

eclectic-tech wrote: January 6th, 2020, 4:18 am Aside: I use GifCam to generate animations in post.
That link to GifCam is to a pretty ancient version 2.0. I would use the latest (6.0 at this writing):

http://blog.bahraniapps.com/gifcam/

I think both GifCam and ScreenToGif do the job really well. Six of one, half dozen the other...

ScreenToGif is probably slightly more full-featured, with a bit better control over things, and GifCam is just stupidly quick and easy to use.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Interrupt a !bang?

Post by balala »

Cariboudjan wrote: January 6th, 2020, 12:22 am Balala, it doesn't work in terms of it doesn't do what I wanted it to do (Not [!Hide] on MouseLeaveAction)
But it does for me, as you can see in the attached animation. If it doesn't for you, please pack the whole config and upload the package. I'd like to check.
Cariboudjan wrote: January 6th, 2020, 12:22 am By the way, Balala, what program do you use to make gifs like that?
Same way as eclectic-tech, I'm using GifCam (version 5.5) as well. According to jsmorley's reply, there might exist a newer one, but I have this and at least for now, it match my needs. Once probably will upgrade to a newer version or will start using another program, especially if I find a better one for my needs.
However as you can see there are lot of such applications out there. Googling the web you probably can find more of them.
User avatar
Cariboudjan
Posts: 264
Joined: May 12th, 2019, 8:55 am

Re: Interrupt a !bang?

Post by Cariboudjan »

I found a way to do it:

It's not interrupting a bang or anything but it effectively does the same thing. The measure resets on MouseLeaveAction, and activates a specific action for a specific meter.

Code: Select all

[Rainmeter]
MiddleMouseUpAction=[!Refresh]
Update=-1

[Variables]
Count=0
StartTimer=0
CountTo=3
MouseOverMeter=0

[Style]
SolidColor=255,0,0
Y=10R
W=50
H=50
MouseOverAction=[!SetVariable MouseOverMeter #CURRENTSECTION#][!SetVariable StartTimer 1][!UpdateMeasure Measure]
MouseLeaveAction=[!SetVariable MouseOverMeter 0][!SetVariable StartTimer 0][!SetOptionGroup Meters SolidColor 255,0,0][!UpdateMeterGroup Meters][!Redraw][!UpdateMeasure Measure]
Group=Meters

[1]
Meter=Image
MeterStyle=Style
Y=0

[2]
Meter=Image
MeterStyle=Style

[3]
Meter=Image
MeterStyle=Style

[4]
Meter=Image
MeterStyle=Style

[5]
Meter=Image
MeterStyle=Style

[Measure]
Measure=Calc
IfCondition=#StartTimer#=1
IfTrueAction=[!Delay 1000][!SetVariable Count (#Count#+1)][!UpdateMeasure Measure]
IfFalseAction=[!SetVariable Count 0]
IfCondition2=#Count#=#CountTo#
IfTrueAction2=[!SetVariable StartTimer 0][!SetOptionGroup Meters SolidColor 255,0,0][!SetOption #MouseOverMeter# SolidColor 0,255,0][!UpdateMeterGroup Meters][!Redraw][!UpdateMeasure Measure]
IfConditionMode=1
UpdateDivider=-1
DynamicVariables=1
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Interrupt a !bang?

Post by balala »

Cariboudjan wrote: January 6th, 2020, 9:09 pm I found a way to do it:
Take care, the [!SetVariable MouseOverMeter #CURRENTSECTION#] bang used into the [Style] section is completely wrong. [Style] is a meter style (used into meters like [1] - [5]). Meters don't have a value and as such you can't set the value of current section to a variable. However I suppose there is a small mistake and that bang should have to be a !SetOption. But in this case there are too less parameters, at least one more is required.
Not sure about your intention.