latin625 Posted April 20, 2023 Share Posted April 20, 2023 I am trying to get the space key on my xarcade to register as UP arrow on Hot Wheels King of the Road and cant seem to get it going. This is my script. It works! when I test it on notepad and stuff I get the cursor going up with each space key press. But when I am playing the game, only the up arrow on the keyboard works and give it gas. Any ideas? Left, right works too. #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. #SingleInstance Force Space::SendInput, {Up} ; Press 2x for Boost/ just pressing will give Gas Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted April 20, 2023 Share Posted April 20, 2023 You may try to just Send it. Space::Send, {Up} And/or the game may be stubborn and want a more deliberate keypress. SetKeyDelay, 100, 50 Space::Send, {Up} 1 Quote Link to comment Share on other sites More sharing options...
latin625 Posted April 21, 2023 Author Share Posted April 21, 2023 (edited) Thanks @JoeViking245. I tried both and they work, kinda... The pressing (pressing up and down) of the space key send the click, but does not detect just pressing down like you would with the keyboard UP key for gas. A double tap of the space or UP key does Turbo boost. Single tap or press give acceleration / gas only. Trying to get the space key to act like the up arrow when pressed down only to give gas, the double tap seems to be 100% good. Ill keep tinkering and see what I get. I see AHk offers something called Send longpress Edited April 21, 2023 by latin625 Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted April 21, 2023 Share Posted April 21, 2023 10 hours ago, latin625 said: Thanks @JoeViking245. I tried both and they work, kinda... The pressing (pressing up and down) of the space key send the click, but does not detect just pressing down like you would with the keyboard UP key for gas. A double tap of the space or UP key does Turbo boost. Single tap or press give acceleration / gas only. Trying to get the space key to act like the up arrow when pressed down only to give gas, the double tap seems to be 100% good. Ill keep tinkering and see what I get. I see AHk offers something called Send longpress If it works without the setkeydelay, go ahead and leave that out. See if this does anything different for you. You may need to adjust the Sleep timer. Space:: while (getkeystate("space","p")) { send, {up down} sleep 100 } send {up up} Return Long press in AHK isn't a feature perse. But when using KeyWait in your hotkey script, you can make a key essentially have dual purpose. Example: Press and hold (aka long press) b to type out "BigBox". Otherwise press (and release) b to type "b". $b:: ;$ is required for "Send, b" { KeyWait, b, T1 ;T1 = 1 second if (ErrorLevel) { Send, BigBox Sleep, 500 ;Sleep needed so it doesn't auto repeat } Else { Send, b Return } } 1 Quote Link to comment Share on other sites More sharing options...
latin625 Posted April 22, 2023 Author Share Posted April 22, 2023 Super Thanks!!!!!!!! It worked! Now I tried to copy and paste the code again to make it work the same way for player 2 using the "2" key on the keypad. This let's player 2 do the same as player one with the gas and boost. Do I need to encapsulate the remap? Didnt work for me when I tried to use player 2. #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. #SingleInstance Force Space:: while (getkeystate("space","p")) { send, {up down} sleep 100 } send {up up} Return q:: while (getkeystate("q","p")) { send, {2 down} sleep 100 } send {2 2} Return Quote Link to comment Share on other sites More sharing options...
latin625 Posted April 22, 2023 Author Share Posted April 22, 2023 What is the P for in the line below? Is it a pause command? while (getkeystate("space","p")) Quote Link to comment Share on other sites More sharing options...
rexryan Posted April 22, 2023 Share Posted April 22, 2023 correct me if I'm wrong It's path. Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted April 22, 2023 Share Posted April 22, 2023 1 minute ago, latin625 said: What is the P for in the line below? Is it a pause command? while (getkeystate("space","p")) "Press[ed]" I think. As in While the {space bar} is pressed. Your 2nd 2 last line (for player 2) should be send {2 up} Return I believe. I'm not at my main PC right now to test/confirm. 1 Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted April 22, 2023 Share Posted April 22, 2023 GetKeyState() / GetKeyState - Syntax & Usage | AutoHotkey 1 Quote Link to comment Share on other sites More sharing options...
latin625 Posted April 22, 2023 Author Share Posted April 22, 2023 P: Retrieve the physical state Quote Link to comment Share on other sites More sharing options...
latin625 Posted April 22, 2023 Author Share Posted April 22, 2023 No joy. Gonna tinker a bit with it. Cant get the Q key to send numpad2 . I am running it separate from the other because I am not sure how to add it to the original script you sent me. It sends it on notepad and I see the number 2, but in the game nothing. I have to press the physical numpad 2 key to give player two gas. q:: while (getkeystate("q","p")) { send, {2 down} sleep 100 } send {2 up} Return Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted April 22, 2023 Share Posted April 22, 2023 Oh, the number pad. Change your 2's to "Numpad2" (without the quotes). You should be able to piggyback both of them into one script. 1 Quote Link to comment Share on other sites More sharing options...
latin625 Posted April 22, 2023 Author Share Posted April 22, 2023 Still nothing. Just wont register. #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. a:: while (getkeystate("a","p")) { send, {Numpad2 down} sleep 100 } send {Numpad2 up} Return Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted April 22, 2023 Share Posted April 22, 2023 Maybe it wants the Number Pad "down arrow" (as in you'd turn the NumLock off) instead of the Number Pad "2". Numpad2 will send "2" (as detected from the number pad). NumpadDown will send the "down arrow" (as detected from the number pad). Try this one. Quote Link to comment Share on other sites More sharing options...
latin625 Posted April 22, 2023 Author Share Posted April 22, 2023 No joy with the suggestion. i might have to live with it being a one player game for now. Everything looks right but doesnt work as expected. Ill keep tinkering ans seeing what is what. Thanks for the help !!!! my latest attempt: #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. #SingleInstance Force l:: while (getkeystate("l","p")) { send, {Numpad2 down} sleep 100 } send {Numpad2 up} Return Quote Link to comment Share on other sites More sharing options...
maxforwardspeed Posted October 4, 2023 Share Posted October 4, 2023 Did you ever get this sorted out? I just installed the game and I get no response from any source for the gas button, regardless of Xinput or Dinput settings in the TP interface. If I use Dinput I can get into the test menu but nothing is registering as a control input to calibrate. I've tried Xbox controllers too with Xinput and nothing. Not using any ahk script, just the control binding in the TP setup. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.