Quick Tile trigger

mmjoshi

Member
I am using the Quick Tile trigger to perform some actions. I want to set a boolean variable to true when the tile is pressed and to set it to false when the same tile is pressed again. When the tile is pressed for the first time, it changes color to blue and the boolean variable is set to true. However, when the tile is pressed again, the color is changed to white but the trigger is not activated and hence I am unable to reset the boolean variable. I am using the Toggle On/Button Press option for the quick tile trigger.

Am I doing something wrong? Is there any other way to achieve the same?
 

mmjoshi

Member
The macro is very simple. I just want to toggle a boolean variable on the quick tile being pressed. Doesn't reset the variable on the second press.
 

Attachments

  • Set_metronome_flag.png
    Set_metronome_flag.png
    56.9 KB · Views: 7

md_sgf

Well-known member
@md_sgf Thank you. That worked. I changed the second if condition to else if so as to avoid running the second loop every time.
Is that required? As only one block should execute on each tile tap, as they each have an If Trigger Fired condition. So the 2nd block will only run if tile turns off, not if is turned on. If the 2nd block runs every time, then something's not right. The whole point of using the If Trigger Fired conditions is precisely to not do what you said it's doing.

You could also, i now realize, just add the Quick Tile Off trigger to your original macro!
Good ideas come when you think (a bit more), rather than just act! :LOL:
 
Last edited:

mmjoshi

Member
Is that required? As only one block should execute on each tile tap, as they each have an If Trigger Fired condition. So the 2nd block will only run if tile turns off, not if is turned on. If the 2nd block runs every time, then something's not right. The whole point of using the If Trigger Fired conditions is precisely to not do what you said it's doing.

You could also, i now realize, just add the Quick Tile Off trigger to your original macro!
Good ideas come when you think (a bit more), rather than just act! :LOL:
I have always trying to figure out how the triggers work. If I understand correctly, if any of the triggers in the macro is fired, the execution starts with the first action in the action block. In this case any of the triggers getting fired the first If condition will get evaluated. If the second condition is Else If the macro will be exited since the first If has been satisfied. If the second condition If is another If with a check for the second trigger, the condition will be evaluated every time the first condition is true.

Hope I am not just rambling!

Your second suggestion is brilliant! Very elegant. Thanks.
 

md_sgf

Well-known member
If the second condition If is another If with a check for the second trigger, the condition will be evaluated every time the first condition is true.
Yes, it will be evaluated when first condition is true, but since it will resolve to false then it won't be run.

You can use Else If, but i prefer separate If's, so i can see all blocks separately when they are collapsed. It's just my personal programming preference. Both can work correctly.
 
Top