Help with making code for keyboard input to controller Topic is solved

Ask gaming related questions
Cmecu
Posts: 4
Joined: 24 Apr 2024, 06:30

Help with making code for keyboard input to controller

Post by Cmecu » 24 Apr 2024, 09:46

I have looked everywhere on the internet but cant find the exact thing I am looking for.

I play the game Dark souls 2 and 3. I play them on my PC. I prefer using Keyboard and mouse. I do have a gamepad but I am not using it, just keyboard and mouse.

In Dark souls 2 I could go into key bindings and change DASH/BACKSTEP/ROLL to the number pad [. DEL] button , and I also could change Jump to the number pad [+] button. You can see in the image underneath how I have it set up
Image

I am now playing Dark Souls 3. The issue is that the default DASH/BACKSTEP/ROLL is bound to game pad B button. When I try to make a new key under Keyboard, when I try to bind the number pad [. Del] key it just doesnt show up , nor does the [+] key when I try to bind jump. What is weird is that it does let me num 2, 4, 6, 8 for my movement, but it will not recognize the aforementioned keys I want to use.
Image

So basically I need a script that says, when I push [.DEL] key that equals me pushing the B button on the game pad.
Then another one that says when I push the [+] key on the number pad it equals me pushing down on the left stick for jump. Unless I can make that another game pad button and just reassign to that button.

This is my controller The B button is the Red Button.
Image

I am sure AHK can do this, or some other program. I tried using UCR and Interception .. not sure how it all worked, tried to make it work, but couldnt. So maybe an AHK code could be made? Any help would be great thank you.

User avatar
boiler
Posts: 17120
Joined: 21 Dec 2014, 02:44

Re: Help with making code for keyboard input to controller

Post by boiler » 24 Apr 2024, 09:52

Cmecu wrote: I am sure AHK can do this, or some other program. I tried using UCR and Interception .. not sure how it all worked, tried to make it work, but couldnt. So maybe an AHK code could be made? Any help would be great thank you.
Native AHK cannot do this. Controller button presses and other inputs cannot be simulated. It requires creating a virtual controller device, which is not straightforward. Read more about it here, which you may have already since you said you have tried using UCR. There's probably not much anyone here (except maybe evilC) will be able to do to help you.

Cmecu
Posts: 4
Joined: 24 Apr 2024, 06:30

Re: Help with making code for keyboard input to controller

Post by Cmecu » 24 Apr 2024, 10:07

Thank you. yes I have seen EvilC name before when I googled codes for stuff..

When I tried that UCR and Interception.. I watched a tutorial video of someone setting it up. But the the thing didnt work for me. I maybe using something old and outdated.
But there has to be some program out there that will allow me to use numpad .DEL key as the input and it simulates the B button being pushed on the game pad.
Its frustrating that Dark souls 2 allows you to bind those buttons to the keyboard, but dark souls 3 doesnt.. Why would they even take that option out.
Anyway, thank you for your help. Hopefully EvilC replies, or I can figure something out.

Noitalommi_2
Posts: 260
Joined: 16 Aug 2023, 10:58

Re: Help with making code for keyboard input to controller  Topic is solved

Post by Noitalommi_2 » 24 Apr 2024, 11:34

Hi.
@Cmecu
Why don't you assign these actions to other free keyboard keys and create NumpadDot and NumpadAdd hotkeys to send these respective keys? :think:

Edit:

Just checked the game, you can use this.
Bind "Dash/Backstep/Roll" to key 9 and "Jump" to key 0 in game.

Code: Select all

#Requires AutoHotkey 2.0
#SingleInstance


; Bind Dash/Backstep/Roll to key 9 and Jump to key 0
; Numpad must be off for NumpadDel to work.

*NumpadDel:: { ; Dash/Backstep/Roll

	SendInput "{9 down}"
	KeyWait "NumpadDel"
	SendInput "{9 up}"
}
*NumpadAdd:: { ;Jump

	SendInput "{0 down}"
	KeyWait "NumpadAdd"
	SendInput "{0 up}"
}

Cmecu
Posts: 4
Joined: 24 Apr 2024, 06:30

Re: Help with making code for keyboard input to controller

Post by Cmecu » 24 Apr 2024, 14:00

Ya if that will work.

Because as you can see in the one picture above it will allow me to bind Jump and the Dash/roll/ backstep to a number pad in put if its a number.. It just wouldnt let me assign it to the numpadDel or Numpadadd
So if I can bind in the game , like you said say numpad9 equals numpadDEL and numpad 3 equals numpadADD then I hope this will work.

Now I have used AHK , i copy and paste the script into notepad , and save as an .ahk file. Then run the script. I do have version 2 downloaded, but never have used it. I only have used version 1.x , So I am hoping it close to being the same when running it.

Cmecu
Posts: 4
Joined: 24 Apr 2024, 06:30

Re: Help with making code for keyboard input to controller

Post by Cmecu » 24 Apr 2024, 14:48

I want to thank you for helping me out. With your basic code I was able to create other pieces. I was able to remap how I opened my inventory screen. Also switching to two handed style fighting.. and even did a two key at the same time to allow me to kick in the game.
I copied from someone else post, but it may been written from AHK version 1.x ?
But it works just fine for me. Guess if its not broke , dont fix it? Or could it been written different? The final piece of code that says Kick.. using numpadIns its pushing the key that makes me go forward numpad8 and light attack numpad3 both have to be pushed at the exact same time. As I said it does work, just not sure if the syntax and code could been written different.

Code: Select all

*NumpadDel:: { ; Dash/Backstep/Roll

	SendInput "{D down}"
	KeyWait "NumpadDel"
	SendInput "{D up}"
}
*NumpadAdd:: { ;Jump

	SendInput "{J down}"
	KeyWait "NumpadAdd"
	SendInput "{J up}"
}
*NumpadMult:: { ; Menu

	SendInput "{O down}"
        KeyWait "NumpadMult"
	SendInput "{O up}"     
}
*NumpadDiv:: { ; Menu

	SendInput "{T down}"
        KeyWait "NumpadDiv"
	SendInput "{T up}"        
}

*NumpadIns:: { ; Kick

	SendInput "{Numpad8 down}"
        Sleep 20
	SendInput "{Numpad3 down}"  
        Sleep 20
        SendInput "{Numpad8 up}" 
        SendInput "{Numpad3 up}"  
        return   
}

Noitalommi_2
Posts: 260
Joined: 16 Aug 2023, 10:58

Re: Help with making code for keyboard input to controller

Post by Noitalommi_2 » 24 Apr 2024, 20:54

@Cmecu

Assumes you're attacking with Numpad 3.
And as you've probably already noticed, the kick only works when you're standing still and the camera is facing forward.

Code: Select all

; Numpad8 = move forward
; Numpad3 = light attack

*NumpadIns:: { ; Kick

	SendInput "{Numpad8 down}"
	Sleep 20
	SendInput "{Numpad8 down}{Numpad3 down}"
    Sleep 20
	SendInput "{Numpad8 up}{Numpad3 up}"
}
Btw. Always send single-letter keys in lowercase, otherwise the game may receive Shift+letter. Upper Case might work in DS3 but could fail in other games.
like so SendInput "{d down}"

Post Reply

Return to “Gaming”