Author Topic: Add Delay to exit button, help  (Read 2477 times)

gleegum

  • Newbie
  • *
  • Posts: 9
    • View Profile
Add Delay to exit button, help
« on: April 25, 2019, 11:15:04 AM »
How can I add a delay to an exit button?
I'm setting up Attract Mode on a racing cabinet and I only have 3 buttons plus the analog controls to navigate through the front end.
I'm used to Maximus Arcade that it has this option to add a delay to any button, so for example, I should press a button for 3 seconds to exit the emulator and go back to the front end.

I can't find any info about this.
Any help would be appreciated!

KTURNER

  • Sr. Member
  • ****
  • Posts: 169
    • View Profile
Re: Add Delay to exit button, help
« Reply #1 on: April 25, 2019, 01:32:48 PM »
What about pushing two buttons at the same time to exit.

gleegum

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Add Delay to exit button, help
« Reply #2 on: April 26, 2019, 08:21:12 AM »
What about pushing two buttons at the same time to exit.
thanks for your reply.
I have it know configured as you say, but I prefer the delay button method.
I see that there's no way to do this without extra software, maybe it can be added in the next release.

hermine.potter

  • Hero Member
  • *****
  • Posts: 767
    • View Profile
Re: Add Delay to exit button, help
« Reply #3 on: April 30, 2019, 06:39:40 AM »
@gleegum
this is an external script for autoit. maybe it's helpful if you are using windows (thanks to Yashied):

Code: [Select]
#Include <Misc.au3>

Global $Pressed = False

While 1
    Sleep(1)
;44 = d on keyboard
;Button Overview : https://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htm
    If _IsPressed('44') Then
        If $Pressed Then
            If TimerDiff($Timer) > 3000 Then
                ;msgbox(0, "", "D three seconds pressed")
;Send Keylist : https://www.autoitscript.com/autoit3/docs/functions/Send.htm
send("{ESC}")
;Exit
            EndIf
        Else
            $Timer = TimerInit()
            $Pressed = 1
        EndIf
    Else
        If $Pressed Then
            ConsoleWrite(Round(TimerDiff($Timer) / 1000, 2) & ' seconds' & @CR)
            $Pressed = 0
        EndIf
    EndIf
WEnd

compile it > start it with windows (autostart and so on) > if you press and hold d on keyboard for 3 seconds, it sends ESC. Script loops.

If you want running script only once/don't loop script, then change ;Exit to Exit (remove semicolon).
AM Version : 2.6.1
Input : Mad Catz Brawlstick; Mouse; Keyboard; Xbox360 Wireless
Cabinet : Yes
OS : Windows10 Pro
System : Dell Precision T3500 ; Intel X5650 ; 12GB RAM