Reactions: Emulating delay type button behaviour

1.08K viewsCSS Questions
0

Im interested in trying out this behaviour but would like to use in reaction; what is the best way to implement? Is there some cut and paste code for it already?

Cheers

admin Changed status to publish May 22, 2024
Attached Files:
0

Its not available to use in a reaction so no copy/paste option, but you could replicate it in a reaction. It could work like this:
How it works is, you press your button, before doing an action, the condition does a calculation which checks the current time minus the previous time you pressed the button. If the result is greater than your required delay time (i.e. 1.5 seconds in the below example), then do the action.
Then finally it stores the current time to modifier m1 for the next time you press the button.

For this example, I’m using modifier m1 and 1.5 as the desired delay time:

You’ll need 1 reaction which contains the following:
Listener: when ‘button x’ is pressed

Action block 1:
Condition: (time.time() – self.get_modifier_value(“m1”)) > 1.5 (note: you will need to switch the condition to ‘custom coding’ to enter it)
Action: “do your desired action”

Action block 2:
Action: Save time.time() to m1 modifier

admin Changed status to publish May 22, 2024
Attached Files: