The NEW Build Your Own Arcade Controls
Main => Main Forum => Topic started by: mccoy178 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 (http://www.autohotkey.com). I then copied and pasted this text (from SpamMe) into a blank text document:
;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!
-
^^^^^^I was wondering about that :applaud:
Are there any alternatives?
-
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).
-
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?
-
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.
-
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.
-
I think we just said the same thing.
-
I think we just said the same thing.
OK ... I gave up coffee a while bac and still haven't woken up ...
Cheers.
-
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. :)
-
I love speculation.
-
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.
-
Awesome! I need to try this.
-
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. :(
-
Well, I bet a post on the forums over at www.autohotkey.com (http://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.
-
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 (http://www.vancefry.com/projects/pixelbox)
-
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 (http://forum.arcadecontrols.com/index.php?topic=45340.msg431069#msg431069)
-
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 (http://www.vancefry.com/projects/pixelbox)
-
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:
-
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.
-
Fantastic find! Works great with my IPAC. I'm not using shift functions. I have a big red "Exit" button mapped to escape. ;)
-
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?
-
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?
-
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 *.
-
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:
-
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.
-
Ahh, I see. What version did that start?
-
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
-
Just get one of these :)
(http://regmedia.co.uk/2006/07/18/usb_nuke_button_1.jpg)
-
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 (http://www.softpedia.com/get/Multimedia/Audio/Audio-Mixers-Synthesizers/VolumeTray.shtml)). 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 (http://www.electracode.com/4/joy2key/JoyToKey%20English%20Version.htm). Be careful which buttons you select. I kept turning down my volume during gameplay by accident. :)
-pmc
-
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.)
-
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.
-
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.