Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Escape key now has to be held down two seconds to work. Sweet!  (Read 11355 times)

0 Members and 1 Guest are viewing this topic.

mccoy178

  • It's hard to work with a straight jacket on
  • Trade Count: (+9)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3127
  • Last login:September 03, 2021, 10:23:42 am
  • Go Bucks!
Escape key now has to be held down two seconds to work. Sweet!
« on: November 07, 2006, 12:38:11 am »
I hate accidental exits from games by my buddies or kids.  To combat this, I found a short AutoHotKey written by member "SpamMe', that made it so that doesn't happen so easily.  I now have to hold down the escape button for two seconds before the game will exit.  I love it.  I also set it up so that it automatically starts when the cabinet is turned on.  Here is how I installed it:

I first downloaded the Auto Hot Key program from www.autohotkey.com.  I then copied and pasted this text (from SpamMe) into a blank text document:

Quote
;HoldEscape:

toggletimer = 0
esckill = 1
SetKeyDelay, 10, 20

$esc::
   if toggletimer = 0
      SetTimer, resettimer, 1000
   toggletimer++
   if toggletimer > 3
      goto, toggleesckill
   if esckill = 1
   {
      tt=0 ; set time to 0
      loop,100
      {
         GetKeyState, s , esc, p
        if s=U
           Break
         tt+=25
         sleep 25
      }
      if tt>=2000  ; if key pressed for 2 or more sec
      {
         send, {esc}
         toggletimer = 0
         sleep 1200
      }
   }
   else
   {
      send, {esc}
   }
return

resettimer:
   toggletimer = 0
return

toggleesckill:
   soundplay, *48
   toggletimer = 0
   esckill *= -1
   sleep 500
return


After that was done, I right clicked on the document, selected properties, and chose to have AutoHotKey open the file by selecting the program from the program files folder.  After that was done, I then copied the document, and put a copy in my startup folder which can be found by using the start menu.  Now it works like a champ! :applaud:  I have attached said .ahk file.  Just delete the .txt after downloading it.  Good luck fellas!

gamenut

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 97
  • Last login:January 05, 2010, 06:11:46 pm
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #1 on: November 07, 2006, 01:06:52 am »
^^^^^^I was wondering about that :applaud:


Are there any alternatives?

ahofle

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4544
  • Last login:August 30, 2023, 05:10:22 pm
    • Arcade Ambience Project
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #2 on: November 07, 2006, 01:07:11 am »
You don't happen to have an IPAC do you?  I'm curious how this would function with the IPAC's shift functionality (if at all).  

mccoy178

  • It's hard to work with a straight jacket on
  • Trade Count: (+9)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3127
  • Last login:September 03, 2021, 10:23:42 am
  • Go Bucks!
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #3 on: November 07, 2006, 07:39:46 am »
I have a keywiz max.  I don't think it matters because in the end, the ipac and the keywiz are both mapped to the escape key on the keyboard no matter what method it is taking to get there.  Does that make sense?

Lilwolf

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4946
  • Last login:July 31, 2022, 10:26:34 pm
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #4 on: November 07, 2006, 08:41:18 am »
I went to mameplus a while ago on my cab.  Helped for a few items, but one of my favorites is that I have to confirm the exit. 

Since I haven't quit by mistake... before then, my daughter would do it all the time leaning against the cab.

CheffoJeffo

  • Cheffo's right! ---saint
  • Wiki Master
  • Trade Count: (+2)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 7780
  • Last login:May 06, 2024, 09:33:37 pm
  • Worthless button pusher!
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #5 on: November 07, 2006, 08:50:50 am »
I have a keywiz max.  I don't think it matters because in the end, the ipac and the keywiz are both mapped to the escape key on the keyboard no matter what method it is taking to get there.  Does that make sense?

But since the Shift functionality resides on the IPac, not Windows, I would expect that the 2-second latency would not apply to the Shift functionality.

Cheers.
Working: Not Enough
Projects: Too Many
Progress: None

mccoy178

  • It's hard to work with a straight jacket on
  • Trade Count: (+9)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3127
  • Last login:September 03, 2021, 10:23:42 am
  • Go Bucks!
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #6 on: November 07, 2006, 09:24:14 am »
I think we just said the same thing.

CheffoJeffo

  • Cheffo's right! ---saint
  • Wiki Master
  • Trade Count: (+2)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 7780
  • Last login:May 06, 2024, 09:33:37 pm
  • Worthless button pusher!
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #7 on: November 07, 2006, 09:46:08 am »
I think we just said the same thing.

OK ... I gave up coffee a while bac and still haven't woken up ...

Cheers.
Working: Not Enough
Projects: Too Many
Progress: None

ahofle

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4544
  • Last login:August 30, 2023, 05:10:22 pm
    • Arcade Ambience Project
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #8 on: November 07, 2006, 11:04:37 am »
I guess I need to give up coffee too...are you saying it will work or it won't?  I was curious because the IPAC shift key does not allow you to 'hold down' the player one start button.  I wasn't sure if the actual shifted functions also behave this way (I assume holding down esc is required for the delay to kick in).  In other words, I'm not sure if pressing and holding '1' and then pressing and holding '2' will cause the PC to think I'm holding down the escape key or if it will only see a momentary esc press.  I suppose I should just download the thing and try it out and see. :)

davieboynj

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 269
  • Last login:June 16, 2011, 01:32:09 am
  • Eating your legs solves lifes little problems.
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #9 on: November 07, 2006, 11:16:28 am »
I love speculation.

mccoy178

  • It's hard to work with a straight jacket on
  • Trade Count: (+9)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3127
  • Last login:September 03, 2021, 10:23:42 am
  • Go Bucks!
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #10 on: November 07, 2006, 11:32:28 am »
I guess I need to give up coffee too...are you saying it will work or it won't?  I was curious because the IPAC shift key does not allow you to 'hold down' the player one start button.  I wasn't sure if the actual shifted functions also behave this way (I assume holding down esc is required for the delay to kick in).  In other words, I'm not sure if pressing and holding '1' and then pressing and holding '2' will cause the PC to think I'm holding down the escape key or if it will only see a momentary esc press.  I suppose I should just download the thing and try it out and see. :)

Yeah, I would recommend downloading it.  It only takes a few minutes.

javeryh

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7917
  • Last login:Today at 12:18:00 pm
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #11 on: November 07, 2006, 08:37:25 pm »
Awesome!  I need to try this.

ahofle

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4544
  • Last login:August 30, 2023, 05:10:22 pm
    • Arcade Ambience Project
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #12 on: November 07, 2006, 09:38:57 pm »
FWIW it doesn't seem to work with the IPAC (at least the older IPAC I have) since ESC is a shifted key.  The IPAC seems to only send one momentary keypress event on shifted keys.  In other words, if you go into notepad and hold the shift key down and then press down on player one Joy1 ('P') and hold it down, you will only get one 'P' and it will never repeat.  I think the script needs to know that you have the key held down to start the timer so it never gets to 2 seconds.  :(

mccoy178

  • It's hard to work with a straight jacket on
  • Trade Count: (+9)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3127
  • Last login:September 03, 2021, 10:23:42 am
  • Go Bucks!
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #13 on: November 07, 2006, 09:45:33 pm »
Well, I bet a post on the forums over at www.autohotkey.com, could get a script that would make the pressing of the escape key to cause a two second delay before acting.  It seams feasible.

vrf

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 355
  • Last login:October 13, 2017, 10:11:54 pm
    • Pixelbox
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #14 on: November 08, 2006, 03:07:55 am »
Nice find. I'm definitely going to check it out once my cab becomes playable. (I have lots of buttons in a small area.)

Next up is to find a way to control the volume without exiting MAME, and just using buttons and joystick. :dunno

mccoy178

  • It's hard to work with a straight jacket on
  • Trade Count: (+9)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3127
  • Last login:September 03, 2021, 10:23:42 am
  • Go Bucks!
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #15 on: November 08, 2006, 04:07:25 am »
There is an entire thread that has a bunch of AHK tricks for cabinets.  Try a search with "AHK fun".  I think the same guy who made this made one for volume also.  If you find it, please post how you installed it. :cheers:

EDIT:  I found the link:
http://forum.arcadecontrols.com/index.php?topic=45340.msg431069#msg431069
« Last Edit: November 08, 2006, 04:44:00 am by mccoy178 »

davieboynj

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 269
  • Last login:June 16, 2011, 01:32:09 am
  • Eating your legs solves lifes little problems.
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #16 on: November 08, 2006, 10:11:28 am »
try a little app called VolumeTray.  it allows you to assign hotkeys to practically any volume adjustment (system, wav, midi, mute...)  I've used it for years. 

http://glorysoft.omsk.ru/volumetray.html

very small and very free.



Nice find. I'm definitely going to check it out once my cab becomes playable. (I have lots of buttons in a small area.)

Next up is to find a way to control the volume without exiting MAME, and just using buttons and joystick. :dunno

diverdown

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 277
  • Last login:December 10, 2023, 12:40:05 am
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #17 on: November 09, 2006, 12:42:14 am »
FWIW it doesn't seem to work with the IPAC (at least the older IPAC I have) since ESC is a shifted key.  The IPAC seems to only send one momentary keypress event on shifted keys.  In other words, if you go into notepad and hold the shift key down and then press down on player one Joy1 ('P') and hold it down, you will only get one 'P' and it will never repeat.  I think the script needs to know that you have the key held down to start the timer so it never gets to 2 seconds.  :(


I didn't like the shifted P1 and P2 = Esc on the ipac because half the time it didn't exit if i wasnt co-ordinated enough..... plus my 4 year old kept exiting when mashing the CP so I installed a black pushbutton under the overhanging CP and assigned Esc to that on my IPAC (using P4 button 6 or something useless)
So now all i have to do is install the above app and no little hands can exit on me mid game

sweeeet :cheers:
If it ain't broke give it to me...i'll soon fix that

ahofle

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4544
  • Last login:August 30, 2023, 05:10:22 pm
    • Arcade Ambience Project
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #18 on: November 09, 2006, 11:54:46 am »
Yeah I sort of regret not having any admin buttons for that reason.  I figured the shift keys would be enough, but my nieces are constantly exiting 2 player coop games when they both hit their respective start buttons at the same time.   I may end up doing as you have done if I can find a stealthy place for the exit button.

MartyNg

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 155
  • Last login:April 26, 2014, 11:37:48 am
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #19 on: December 19, 2006, 08:42:27 pm »
Fantastic find! Works great with my IPAC. I'm not using shift functions. I have a big red "Exit" button mapped to escape.  ;)

Anubis_au

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 415
  • Last login:January 15, 2023, 10:12:32 pm
  • Ever danced with the Devil in the pale moonlight?
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #20 on: December 05, 2007, 08:46:54 pm »
Well, it's been a year on this thread...

Did anyone get around to testing if the IPAC2 works with this autohotkey when you use the shifted function to produce an escape keypress?

MartyNg confirms it works when not shifted (as expected)... what about when shifted? Does the IPAC produce a stream of characters (and thus, would work after 2 seconds), or does it produce only a single character?

urbecrisch

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 597
  • Last login:June 08, 2024, 02:52:43 pm
  • I was the S**T back in '82
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #21 on: April 21, 2008, 11:27:25 pm »
I just setup Autohotkey with the above script so the ESC key has to be held to exit a game.

I tried to run the script in MameUI v.123 but it doesn't work.  It works in Mala and in Mame v.106 but not v.123.  Anyone know why this would be happening?

Stub

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 155
  • Last login:March 30, 2024, 12:23:15 pm
  • Sensory Overload
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #22 on: April 22, 2008, 10:52:55 am »
Change the script to use a different key. Lets say you set your admin exit button to the * key use the script to trigger an (ecs) after 2 seconds of *.

urbecrisch

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 597
  • Last login:June 08, 2024, 02:52:43 pm
  • I was the S**T back in '82
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #23 on: April 22, 2008, 02:24:29 pm »
This still doesn't explain why I would be having a problem with this script in v.123 but v.106 and Mala the script works fine.  :dizzy:

TheShanMan

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1911
  • Last login:October 16, 2023, 03:35:12 pm
    • My Arcade (updated 1/30/13)
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #24 on: April 22, 2008, 03:37:02 pm »
I think you can no longer programmatically send keystrokes to mame, which if I understand what is being described here, is what autohotkeys is doing.
My Collection: Mame cab, 38 dedicated vids, pin, skeeball, coin op air hockey table, Ice Cold Beer, Megatouch, 2 token machines, and payphone (VAPS, pics at Arcade Crusade)

Add Ambience to your mame cab setup

urbecrisch

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 597
  • Last login:June 08, 2024, 02:52:43 pm
  • I was the S**T back in '82
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #25 on: April 22, 2008, 08:30:31 pm »
Ahh, I see.  What version did that start?

Stormrider

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 318
  • Last login:September 28, 2014, 11:01:54 am
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #26 on: April 23, 2008, 08:41:06 am »
Is there any way I could use this with a button og my panel considering it uses a PSX pad hack?
I'm also interested in the vol + vol + function. The link you wrotte doesn't work. It would be great if I could map this to start button + joy up / joy down

brandon

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 807
  • Last login:October 19, 2023, 03:08:43 pm
  • I <3 arcade games.
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #27 on: April 23, 2008, 12:15:00 pm »
Just get one of these :)



pmc

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1034
  • Last login:December 20, 2023, 07:43:02 am
    • website
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #28 on: April 23, 2008, 01:56:27 pm »
Is there any way I could use this with a button og my panel considering it uses a PSX pad hack?
I'm also interested in the vol + vol + function. The link you wrotte doesn't work. It would be great if I could map this to start button + joy up / joy down

It looks like Slav Glory (VolumeTray) took down his website but you can find it elsewhere (like here). It's a nice little (free) program.

If your pad hack is ultimately sending keystrokes to the OS it should work OK. Otherwise, you may have to try something like JoyToKey. Be careful which buttons you select. I kept turning down my volume during gameplay by accident. :)

-pmc

u_rebelscum

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3633
  • Last login:April 21, 2010, 03:06:26 pm
  • You rebel scum
    • Mame:Analog+
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #29 on: April 23, 2008, 02:26:20 pm »
This still doesn't explain why I would be having a problem with this script in v.123 but v.106 and Mala the script works fine.  :dizzy:

Mame stopped using directX directInput for the keyboard and started using microsoft's newer RawInput.  Old xyz2key apps are not RawInput compatible, just like old apps weren't good for directInput when directInput for keyboard was started to be used.  FWIW, RawInput is doing most of what directInput was supported to (aka "marketed as") do with

Just wait a little while and (hopefullly) the xyz2key apps will be updated.  (The problem with this is AFAIK, mame is the only game or game related app that uses RawInput.)
Robin
Knowledge is Power

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #30 on: April 23, 2008, 06:50:04 pm »
Mame stopped using directX directInput for the keyboard and started using microsoft's newer RawInput.  Old xyz2key apps are not RawInput compatible, just like old apps weren't good for directInput when directInput for keyboard was started to be used.  FWIW, RawInput is doing most of what directInput was supported to (aka "marketed as") do with

Just wait a little while and (hopefullly) the xyz2key apps will be updated.  (The problem with this is AFAIK, mame is the only game or game related app that uses RawInput.)

I have written a program that can inject keys into Mame's RawInput system but it's quite a hack to achieve it. If there wasn't so much controversy about sending keys to Mame I would have released it already. But if anyone remembers the response to my CoinDrop app I don't think it's worth it. If I find a practical use for it and I can hard code it so it can't be used for coin counting then I might consider releasing it.

urbecrisch

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 597
  • Last login:June 08, 2024, 02:52:43 pm
  • I was the S**T back in '82
Re: Escape key now has to be held down two seconds to work. Sweet!
« Reply #31 on: April 23, 2008, 11:31:39 pm »
Headkaze, be sure to announce in the forum if you do release the program cause I'll definitely get some good use out of it.