It is currently April 25th, 2024, 6:12 am

Calling ActionTimer Action Lists under specific conditions?

Get help with creating, editing & fixing problems with skins
User avatar
Krainz
Posts: 186
Joined: May 27th, 2012, 5:16 am

Calling ActionTimer Action Lists under specific conditions?

Post by Krainz »

ActionTimer Conditions?

I have a volumous ActionTimer controlling the ATX variable.

However, I want ActionList1 and ActionList2 to not work while ATX is lower than 2 and higher than #Limit2#.

I've tried making a measure that would control the ActionTimer (called MeasureMover) but it just wouldn't work.

Code: Select all

[StopMover]
Measure=Calc
Formula=(#ATX#)
IfCondition=StopMover < 2
IfTrueAction=[!CommandMeasure MeasureMover "Stop 1"]
IfCondition2=StopMover > #Limit2#
IfTrueAction2=[!CommandMeasure MeasureMover "Stop 2"]
The problem is, MeasureMover is triggered by MouseScrollUpAction and MouseScrollDownAction. Even when ATX reaches its limits, mousescrolls beyond limit still register to rainmeter, while I wish they just wouldn't.

If I could make something like:

Code: Select all

mousescrollupAction=(#ATX# > 1 ? [!CommandMeasure MeasureMover "Execute 2"] : "")
mousescrolldownAction=(#ATX# < #Limit2# ? [!CommandMeasure MeasureMover "Execute 1"])
But it doesn't work.

Another condition I need is regarding Execute 7 and 8.

Code: Select all

[LeftKeyboard]
Measure=Plugin
Plugin=HotKey
HotKey=LEFT
KeyDownAction=[!CommandMeasure MeasureMover "Execute 8"][!CommandMeasure RightKeyboard Start][!EnableMeasureGroup GamepadRight][!Redraw]
DynamicVariables=1

[RightKeyboard]
Measure=Plugin
Plugin=HotKey
HotKey=RIGHT
KeyDownAction=[!CommandMeasure MeasureMover "Execute 7"][!CommandMeasure LeftKeyboard Start][!EnableMeasureGroup GamepadLeft][!Redraw]
DynamicVariables=1
I need Execute 7 and Execute 8 to only work while the [CurrentN] value is higher than 5. Trying to make it with parenthesis didn't work out.

Is this possible to do?
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Calling ActionTimer Action Lists under specific conditions?

Post by balala »

Krainz wrote: December 13th, 2019, 11:55 am However, I want ActionList1 and ActionList2 to not work while ATX is lower than 2 and higher than #Limit2#.

I've tried making a measure that would control the ActionTimer (called MeasureMover) but it just wouldn't work.

Code: Select all

[StopMover]
Measure=Calc
Formula=(#ATX#)
IfCondition=StopMover < 2
IfTrueAction=[!CommandMeasure MeasureMover "Stop 1"]
IfCondition2=StopMover > #Limit2#
IfTrueAction2=[!CommandMeasure MeasureMover "Stop 2"]
The problem is, MeasureMover is triggered by MouseScrollUpAction and MouseScrollDownAction. Even when ATX reaches its limits, mousescrolls beyond limit still register to rainmeter, while I wish they just wouldn't.
First add a DynamicVariables=1 option to the above measure, because if the variables are set dynamically (through some !SetVariable bangs) you can't use them, unless you're making the above setting.
Krainz wrote: December 13th, 2019, 11:55 am However, I want ActionList1 and ActionList2 to not work while ATX is lower than 2 and higher than #Limit2#.

I've tried making a measure that would control the ActionTimer (called MeasureMover) but it just wouldn't work.

Code: Select all

[StopMover]
[code]mousescrollupAction=(#ATX# > 1 ? [!CommandMeasure MeasureMover "Execute 2"] : "")
mousescrolldownAction=(#ATX# < #Limit2# ? [!CommandMeasure MeasureMover "Execute 1"])
But it doesn't work.
Normally. Mathematical formulas are working ONLY with numbers. The above things can be set through !SetOption bangs. This way it never will work.
User avatar
Krainz
Posts: 186
Joined: May 27th, 2012, 5:16 am

Re: Calling ActionTimer Action Lists under specific conditions?

Post by Krainz »

balala wrote: December 13th, 2019, 2:04 pm First add a DynamicVariables=1 option to the above measure, because if the variables are set dynamically (through some !SetVariable bangs) you can't use them, unless you're making the above setting.
No bueno, still keeps queueing several mousescroll inputs when they should just stop when reaching the limit.

I even tried adding a SetOption but it doesn't seem to work

Code: Select all

[StopMover]
Measure=Calc
Formula=(#ATX#)
IfCondition=StopMover < 2
IfTrueAction=[!CommandMeasure MeasureMover "Stop 1"][!SetOption Rainmeter mousescrollupAction ""][!Update][!Redraw]
IfCondition2=StopMover > #Limit2#
IfTrueAction2=[!CommandMeasure MeasureMover "Stop 2"][!SetOption Rainmeter mousescrolldownAction ""][!Update][!Redraw]
DynamicVariables=1
balala wrote: December 13th, 2019, 2:04 pmNormally. Mathematical formulas are working ONLY with numbers. The above things can be set through !SetOption bangs. This way it never will work.
Well, I have these three Calcs. You can see that CurrentN has an IfCondition and those are in place to work with left and right key inputs. These, on the contrary of the mousescroll inputs, correctly stop being registered after reaching the limit.

Code: Select all

[CurrentN]
Measure=Calc
Formula=1
UpdateDivider=-1
IfCondition=CurrentN < 1
IfTrueAction=[!CommandMeasure MeasureMover "Stop 7"][!SetOption CurrentN Formula "1"][!CommandMeasure LeftKeyboard Stop][!DisableMeasureGroup GamepadLeft][!UpdateMeasure CurrentN]
IfCondition2=CurrentN > #NumberOfItems#
IfTrueAction2=[!CommandMeasure MeasureMover "Stop 8"][!SetOption CurrentN Formula #NumberOfItems#][!CommandMeasure RightKeyboard Stop][!DisableMeasureGroup GamepadRight][!UpdateMeasure CurrentN]
DynamicVariables=1

[PressLeftCounter]
Measure=Calc
Formula=PressLeftCounter + 1
Disabled=1
UpdateDivider=-1
OnUpdateAction=[!SetOption CurrentN Formula "([CurrentN] - 1)"][!UpdateMeasure CurrentN][!Redraw]

[PressRightCounter]
Measure=Calc
Formula=PressRightCounter + 1
Disabled=1
UpdateDivider=-1
OnUpdateAction=[!SetOption CurrentN Formula "([CurrentN] + 1)"][!UpdateMeasure CurrentN][!Redraw]
Now, on the second issue, regarding Execute 7 and 8, I had the following idea:

You can see that the KeyDownActions are quite extensive:

Code: Select all

[LeftKeyboard]
Measure=Plugin
Plugin=HotKey
HotKey=LEFT
KeyDownAction=[!HideMeter "btn[CurrentN]"][!EnableMeasure PressLeftCounter][!UpdateMeasure PressLeftCounter][!ShowMeter "btn[CurrentN]"][!CommandMeasure MeasureMover "Execute 8"][!CommandMeasure RightKeyboard Start][!EnableMeasureGroup GamepadRight][!Redraw]
DynamicVariables=1

[RightKeyboard]
Measure=Plugin
Plugin=HotKey
HotKey=RIGHT
KeyDownAction=[!HideMeter "btn[CurrentN]"][!EnableMeasure PressRightCounter][!UpdateMeasure PressRightCounter][!ShowMeter "btn[CurrentN]"][!CommandMeasure MeasureMover "Execute 7"][!CommandMeasure LeftKeyboard Start][!EnableMeasureGroup GamepadLeft][!Redraw]
DynamicVariables=1
Since I only want Execute 7 and Execute 8 to register within specific CurrentN value ranges, is it possible for me to have a Measure that controls this?

In other words, instead of putting a !commandmeasure measuremover within those two keydownactions, I put a !CommandMeasure ControlMeasure (Activate???Execute???) with IfCondition and IfTrueAction.

IfCondition=CurrentN > 4
IfTrueAction=[!CommandMeasure MeasureMover "Execute 8"]

Is this possible? Would that work? How do I do it?
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Calling ActionTimer Action Lists under specific conditions?

Post by balala »

Krainz wrote: December 13th, 2019, 7:55 pm No bueno, still keeps queueing several mousescroll inputs when they should just stop when reaching the limit.

I even tried adding a SetOption but it doesn't seem to work
Yes, because [Rainmeter] section doesn't support dynamic changes. Nor !SetOption, nor !SetVariable doesn1t work on this section.
But what does work is the !DisableMouseAction bang:

Code: Select all

[StopMover]
Measure=Calc
Formula=(#ATX#)
IfCondition=StopMover < 2
IfTrueAction=[!CommandMeasure MeasureMover "Stop 1"][!DisableMouseAction Rainmeter "MouseScrollUpAction"][!Update]
IfCondition2=StopMover > #Limit2#
IfTrueAction2=[!CommandMeasure MeasureMover "Stop 2"][!DisableMouseAction Rainmeter "MouseScrollDownAction"][!Update]
DynamicVariables=1
Note that I removed the [!Redraw] bangs as well, because when the skin is updated (this time through a !Update bang), a redrawn is also completed, so there isn't needed to add the [!Redraw] bang as well.

However, a more or less complete code (or a packed config), would still be needed. Please help us to help you.
User avatar
Krainz
Posts: 186
Joined: May 27th, 2012, 5:16 am

Re: Calling ActionTimer Action Lists under specific conditions?

Post by Krainz »

balala wrote: December 13th, 2019, 9:18 pm Yes, because [Rainmeter] section doesn't support dynamic changes. Nor !SetOption, nor !SetVariable doesn1t work on this section.
But what does work is the !DisableMouseAction bang:

Code: Select all

[StopMover]
Measure=Calc
Formula=(#ATX#)
IfCondition=StopMover < 2
IfTrueAction=[!CommandMeasure MeasureMover "Stop 1"][!DisableMouseAction Rainmeter "MouseScrollUpAction"][!Update]
IfCondition2=StopMover > #Limit2#
IfTrueAction2=[!CommandMeasure MeasureMover "Stop 2"][!DisableMouseAction Rainmeter "MouseScrollDownAction"][!Update]
DynamicVariables=1
Note that I removed the [!Redraw] bangs as well, because when the skin is updated (this time through a !Update bang), a redrawn is also completed, so there isn't needed to add the [!Redraw] bang as well.
Thank you, I think this solved the scroll queueing issue. I also had to pay attention to the fact that #Limit2# is a negative X number (because the meters are being moved to the left) so I had to adjust the conditions properly.

Here's the final (I guess?) StopMover code:

Code: Select all

[StopMover]
Measure=Calc
Formula=(#ATX#)
IfCondition=StopMover > 21
IfTrueAction=[!CommandMeasure MeasureMover "Stop 1"][!DisableMouseAction Rainmeter "MouseScrollUpAction"][!Update]
IfFalseAction=[!EnableMouseAction Rainmeter "MouseScrollUpAction"][!Update]
IfCondition2=StopMover <= #Limit2#
IfTrueAction2=[!CommandMeasure MeasureMover "Stop 2"][!DisableMouseAction Rainmeter "MouseScrollDownAction"][!Update]
IfFalseAction2=[!EnableMouseAction Rainmeter "MouseScrollDownAction"][!Update]
DynamicVariables=1


As to regarding my Execute 7 and Execute 8 issue, I wrote these two measures:

Code: Select all

[KeyScrollControlL]
Measure=Calc
Formula=CurrentN
UpdateDivider=-1
DynamicVariables=1
IfCondition=CurrentN > 4
IfTrueAction=[!CommandMeasure MeasureMover "Execute 7"]

[KeyScrollControlR]
Measure=Calc
Formula=CurrentN
UpdateDivider=-1
DynamicVariables=1
IfCondition=CurrentN > 4
IfTrueAction=[!CommandMeasure MeasureMover "Execute 8"]
I don't know what are their limitations, and whether they are performance-efficient or not, but I ran a Find/Replace All on Notepad and replaced

Code: Select all

[!CommandMeasure MeasureMover "Execute 7"]
and

Code: Select all

[!CommandMeasure MeasureMover "Execute 8"]
by respectively:

Code: Select all

[!Updatemeasure KeyScrollControlL]
and

Code: Select all

[!Updatemeasure KeyScrollControlR]
for all meters that had the Execute 7 and Execute 8 line in them, which were pretty much just hotkey meters. Here they are if anyone's interested:

Code: Select all

[LeftKeyboard]
Measure=Plugin
Plugin=HotKey
HotKey=LEFT
KeyDownAction=[!HideMeter "btn[CurrentN]"][!EnableMeasure PressLeftCounter][!UpdateMeasure PressLeftCounter][!ShowMeter "btn[CurrentN]"][!UpdateMeasure KeyScrollControlR][!CommandMeasure RightKeyboard Start][!EnableMeasureGroup GamepadRight][!Redraw]
DynamicVariables=1

[RightKeyboard]
Measure=Plugin
Plugin=HotKey
HotKey=RIGHT
KeyDownAction=[!HideMeter "btn[CurrentN]"][!EnableMeasure PressRightCounter][!UpdateMeasure PressRightCounter][!ShowMeter "btn[CurrentN]"][!UpdateMeasure KeyScrollControlL][!CommandMeasure LeftKeyboard Start][!EnableMeasureGroup GamepadLeft][!Redraw]
DynamicVariables=1

[Enter]
Measure=Plugin
Plugin=HotKey
HotKey=PGUP
KeyUpAction=[!CommandMeasure "mIndex[CurrentN]" "Open"][!UpdateMeasure FVMeasure][!UpdateMeterGroup Items][!Redraw][!ToggleConfig "AsperiaSuite\Gamehall\Tiles" "GameScreen1-Tiles.ini"][!ToggleConfig "AsperiaSuite\Gamehall\GameScreen1" "GameScreen1-bg.ini"]
DynamicVariables=1

[XInput_Dpad_U]
Measure=Plugin
Plugin=XInput
Device=0
Channel=Dpad_U
IfEqualValue=1
IfEqualAction=[!HideMeter "btn[CurrentN]"][!EnableMeasure PressLeftCounter][!UpdateMeasure PressLeftCounter][!ShowMeter "btn[CurrentN]"][!UpdateMeasure KeyScrollControlR][!CommandMeasure RightKeyboard Start][!EnableMeasureGroup GamepadRight][!Redraw]
Group=GamepadLeft
DynamicVariables=1

[XInput_Dpad_D]
Measure=Plugin
Plugin=XInput
Device=0
Channel=Dpad_D
IfEqualValue=1
IfEqualAction=[!HideMeter "btn[CurrentN]"][!EnableMeasure PressRightCounter][!UpdateMeasure PressRightCounter][!ShowMeter "btn[CurrentN]"][!UpdateMeasure KeyScrollControlL][!CommandMeasure LeftKeyboard Start][!EnableMeasureGroup GamepadLeft][!Redraw]
Group=GamepadRight
DynamicVariables=1

[XInput_Dpad_L]
Measure=Plugin
Plugin=XInput
Device=0
Channel=Dpad_L
IfEqualValue=1
IfEqualAction=[!HideMeter "btn[CurrentN]"][!EnableMeasure PressLeftCounter][!UpdateMeasure PressLeftCounter][!ShowMeter "btn[CurrentN]"][!UpdateMeasure KeyScrollControlR][!CommandMeasure RightKeyboard Start][!EnableMeasureGroup GamepadRight][!Redraw]
Group=GamepadLeft
DynamicVariables=1

[XInput_Dpad_R]
Measure=Plugin
Plugin=XInput
Device=0
Channel=Dpad_R
IfEqualValue=1
IfEqualAction=[!HideMeter "btn[CurrentN]"][!EnableMeasure PressRightCounter][!UpdateMeasure PressRightCounter][!ShowMeter "btn[CurrentN]"][!UpdateMeasure KeyScrollControlL][!CommandMeasure LeftKeyboard Start][!EnableMeasureGroup GamepadLeft][!Redraw]
Group=GamepadRight
DynamicVariables=1

[XInput_Face_D]
Measure=Plugin
Plugin=XInput
Device=0
Channel=Face_D
IfEqualValue=1
IfEqualAction=[!CommandMeasure "mIndex[CurrentN]" "Open"][!UpdateMeasure FVMeasure][!UpdateMeterGroup Items][!Redraw][!ToggleConfig "AsperiaSuite\Gamehall\Tiles" "GameScreen1-Tiles.ini"][!ToggleConfig "AsperiaSuite\Gamehall\GameScreen1" "GameScreen1-bg.ini"]
DynamicVariables=1

[XInput_Face_R]
Measure=Plugin
Plugin=XInput
Device=0
Channel=Face_R
IfEqualValue=1
IfEqualAction=[!ToggleConfig "AsperiaSuite\Gamehall\Tiles" "GameScreen1-Tiles.ini"][!ToggleConfig "AsperiaSuite\Gamehall\GameScreen1" "GameScreen1-bg.ini"]
DynamicVariables=1

[XInput_Back]
Measure=Plugin
Plugin=XInput
Device=0
Channel=Back
IfEqualValue=1
IfEqualAction=[!ToggleConfig "AsperiaSuite\Gamehall\Tiles" "GameScreen1-Tiles.ini"][!ToggleConfig "AsperiaSuite\Gamehall\GameScreen1" "GameScreen1-bg.ini"]
DynamicVariables=1

[XInput_JoyL_XL]
Measure=Plugin
Plugin=XInput
Device=0
Channel=JoyL_X
IfBelowValue=-0.8
IfBelowAction=[!HideMeter "btn[CurrentN]"][!EnableMeasure PressLeftCounter][!UpdateMeasure PressLeftCounter][!ShowMeter "btn[CurrentN]"][!UpdateMeasure KeyScrollControlR][!CommandMeasure RightKeyboard Start][!EnableMeasureGroup GamepadRight][!Redraw]
IfConditionMode=1
Group=GamepadLeft
DynamicVariables=1

[XInput_JoyL_XR]
Measure=Plugin
Plugin=XInput
Device=0
Channel=JoyL_X
IfAboveValue=0.8
IfAboveAction=[!HideMeter "btn[CurrentN]"][!EnableMeasure PressRightCounter][!UpdateMeasure PressRightCounter][!ShowMeter "btn[CurrentN]"][!UpdateMeasure KeyScrollControlL][!CommandMeasure LeftKeyboard Start][!EnableMeasureGroup GamepadLeft][!Redraw]
IfConditionMode=1
Group=GamepadRight
DynamicVariables=1

[XInput_JoyL_YL]
Measure=Plugin
Plugin=XInput
Device=0
Channel=JoyL_Y
IfAboveValue=0.8
IfAboveAction=[!HideMeter "btn[CurrentN]"][!EnableMeasure PressLeftCounter][!UpdateMeasure PressLeftCounter][!ShowMeter "btn[CurrentN]"][!UpdateMeasure KeyScrollControlR][!CommandMeasure RightKeyboard Start][!EnableMeasureGroup GamepadRight][!Redraw]
IfConditionMode=1
Group=GamepadLeft
DynamicVariables=1

[XInput_JoyL_YR]
Measure=Plugin
Plugin=XInput
Device=0
Channel=JoyL_Y
IfBelowValue=-0.8
IfBelowAction=[!HideMeter "btn[CurrentN]"][!EnableMeasure PressRightCounter][!UpdateMeasure PressRightCounter][!ShowMeter "btn[CurrentN]"][!UpdateMeasure KeyScrollControlL][!CommandMeasure LeftKeyboard Start][!EnableMeasureGroup GamepadLeft][!Redraw]
IfConditionMode=1
Group=GamepadRight
DynamicVariables=1
My final question is: should I be wary of using this method of updating a calc measure to control whether or not Execute 7 and 8 get to happen? Does this pose any risk to performance when acting together with dozens and dozens of meters in the same file? Should I look for other solutions?
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Calling ActionTimer Action Lists under specific conditions?

Post by balala »

Krainz wrote: December 14th, 2019, 5:03 am Thank you, I think this solved the scroll queueing issue.
Ok, I'm glad.
Krainz wrote: December 14th, 2019, 5:03 am I also had to pay attention to the fact that #Limit2# is a negative X number (because the meters are being moved to the left) so I had to adjust the conditions properly.
Unfortunately not knowing what's going on the skin (because a complete code still isn't posted), I can't say how could you do this. The Abs function might help, but depending on what and how you'd like to achieve, it might be a little bit more complicated.
Krainz wrote: December 14th, 2019, 5:03 am My final question is: should I be wary of using this method of updating a calc measure to control whether or not Execute 7 and 8 get to happen? Does this pose any risk to performance when acting together with dozens and dozens of meters in the same file? Should I look for other solutions?
And again: if we don't know the code (because still isn't posted), probably no one will be able to help. So please for further help, post a code or upload the packed config (especially if it uses some resources).