Attract-Mode Support Forum
Attract-Mode Support => Scripting => Topic started by: dukpoki on July 25, 2019, 11:32:17 AM
-
How to disable a button press for an xx amount of time on transition? For example, let's say I want to disable the up and down keys for 5 seconds whenever you load a layout. After 5 seconds, they can then be functional.
-
Hi dukpoki, I see you had no answer to your question, I don't have the documentation at hand to check but this can be done this way. What you need is:
Define a boolean like "deafkeys = true" at the beginning of the layout
Add a signal callback function, when the signal is "up" or "down" check if deafkeys is true or false and if it's true don't process the signal.
Add a tick callback to your theme, the parameter tick_time of the tick callback function is the time since the start of the layout. Just check at the beginning of the tick function if tick_time is greater than your desired delay time and turn deafkeys to off
-
Thanks zpaolo. I haven't tried it yet but I'll give it a go later.