PDA

View Full Version : assign keys on script



jrcp_kun
06-25-2010, 01:19 PM
i want in messpp for atari5200 remap de f1 key to be the 1 key to start the game
how is the way to remap keys on the ahk file??

thanks

jbarket
07-03-2010, 03:18 PM
The syntax is really simple. It's just original key::new key

So like

LCtrl::A

To make left control send A. I'd assume it's just

F1::1

But I'm not sure what F1 is.

sosfx
07-04-2010, 01:43 AM
Hi Jbarket
I have always had an issue with the keys in nulldc due to having a jvs-pac and I am not able to reprogramme it.
so would this change the button press from the jvs-pac to the emu ie press LCtrl on jvs = e in the emu?
so could you let me have the full ahk for nuldc key reassignment or is it just as as u have put ie lalt =whatever I want
if this work you are going to save me buying a jpac and having to rewiring my cab
thanks in advance

jbarket
07-04-2010, 11:15 AM
That's the idea. I don't have it perfect yet, but that works. Just make sure you call it like:

RunWait, %executable%
ExitApp
Return

LCtrl::e
LAlt::r
Space::t
LShift::y
Return

Without ExitApp and both of those Returns, HyperLaunch just never closes. With them, it works like a champ.

At the moment, I'm having a weird issue where, even though my remapping code is inside the if statement... like if foo == "nulldc"... it still gets applied to everything. I'm just assuming that's how AHK works. I'm trying to figure out #IfWinActive now, which only applies things to a particular window.

But, you could easily use it to remap keys across the board for your jvs-pac.

The one thing I'll say, though, is that I could _not_ get nulldc to take the Q key (Player 2, Button 3) remapped. It worked when I tested it everywhere else, but in nulldc, it would ignore the key all together.

So, if you can get around that somehow, this should give you an easy way to reassign your keys.

Good luck!

chillinwater
07-05-2010, 09:37 AM
The Q key may be giving you troubles because of this line

;------------------------------------------------------------------------------;
; MAIN SETTINGS ;
;------------------------------------------------------------------------------;
;[UNIVERSAL HOTKEYS] ;SEPERATE MULTIPLE KEYS WITH &(ampersand) up to 2 keys.
exitScriptKey = q & s ;Secret hotkey(s) to exit script if needed
;Not to be confused with exit emulator keys

exitEmulatorKey = Esc ;This key/key combo will close any emulators
;that do not have normal closing methods.
you can change q & s to somthing else (non-conflicting) or add tilde's "~" to them
exitScriptKey = ~q & ~s

I think the "#IfWinActive" goes like this (working on it myself):

RunWait, %executable%
ExitApp
Return
#IfWinActive, %executable% ;or actual executebles window name
LCtrl::e
LAlt::r
Space::t
LShift::y
#IfWinActive ;has to enclose the window\executable's specific commands
Return

sosfx
08-21-2010, 05:17 AM
not so good with ahk :( is this right ?
would love to get this working


;*********************************SEGA DREAMCAST********************************

else if (systemName = "Sega Dreamcast" && executable = "nullDC_Win32_Release-NoTrace.exe")
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess
Run, %Executable% -config ImageReader:DefaultImage="%romPath%%romName%%romExtension%", %EmuPath%, Hide UseErrorLevel
Sleep,1000
WinShow, ahk_class ndc_main_window
Process, WaitClose, nullDC_Win32_Release-NoTrace.exe

RunWait, %executable%
ExitApp
Return

LCtrl::e
LAlt::r
Space::t
LShift::y
Return
}

chillinwater
08-21-2010, 09:05 AM
Are you using an X-Arcade or similar controller?

I get tired and frustrated myself, trying to remap controls within the hyperlaunch script.
I cant always get them working properly due to my lack of skills.
(conflicts with other remaps in other system scripts or just cant place them correctly.)

So here is a cheat...

[Remapper.ahk]

LCtrl::e
LAlt::r
Space::t
LShift::y

to test the Remapper outside Hyperspin:
-copy\save\compile
-lclick on remapper.exe
-open new blank text file
-test your buttons
If working the way you want it,
-then add these lines to your Sega Dreamcast Hyperlaunch script below

-Using the script you posted above or any script (if its working for you) here is where it should go
This also would be the approximate locations for use in any other system script if needed.
The directory below is for universal access (other systems), if placed in the Hyperspin root directory,
but you could place it anywhere and change the directory to where you placed it.

;*********************************SEGA DREAMCAST********************************

else if (systemName = "Sega Dreamcast" && executable = "nullDC_Win32_Release-NoTrace.exe")
{
hideDesktop()
Hotkey, %exitEmulatorKey%, CloseProcess
Run, %A_ScriptDir%\Remapper.exe
Run, %Executable% -config ImageReader:defaultImage="%romPath%%romName%%romExtension%", %EmuPath%, Hide UseErrorLevel
Sleep,1000
WinShow, ahk_class ndc_main_window
Process, WaitClose, nullDC_Win32_Release-NoTrace.exe
Process, Close, Remapper.exe
;winactivate, Hyperspin.exe ;remove ";" if needed
;exitapp ;remove ";" if needed
}

Zinger19
08-21-2010, 10:36 AM
Yeah chillinwater is definitely right. The easiest way to remap keys is to create a separate remap ahk. It will work with most programs and is pretty simple to do.

sosfx
08-21-2010, 12:44 PM
OMG THANK U SOOOOOO MUCH chillinwater
that works a charm I am using a JVS-PAC its like a IPAC but this is for a naomi cab that i have hyperspin working on.
I was comming so close to rewiring the whole cab and getting a IPAC because of this !!

thanks once again :)
from a very happy sosfx

chillinwater
08-21-2010, 01:42 PM
cool glad to help!:D You just made my day!