Xbox Controller to Start Steam

Ask gaming related questions (AHK v1.1 and older)
Jiffers211
Posts: 4
Joined: 26 Jun 2017, 18:59

Xbox Controller to Start Steam

26 Jun 2017, 19:10

Hey!
I'm extremely new to programming.
I need to program an Xbox controller to start up a Steam game. I need it to be able to run the game after holding down the right and left bumpers and left and right trigger along with A. Needs to be complicated enough so players probably won't hit the same combination in game.
Again, I'm very new. I'm able to use AHK with my keyboard, but I can't get it to work with the controller. It's completely possible I'm going this wrong.
The controller works with the computer. It's calibrated for Steam and works with Gopher, so I didn't think that was the issue.
Any help would be appreciated!

Thanks,
Taylor
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Xbox Controller to Start Steam

27 Jun 2017, 06:14

You need to be more clear.
Are you trying to read input from a physical xbox controller, or are you trying to synthesize fake xbox controller output.
If the latter, AHK cannot do that, you need to use vXBox from the vJoy API, but there is currently no AHK wrapper for vXBox.

I am the guy who maintains the AHK vJoy wrapper, I just never got around to adding vXBox support, but I do have the code as part of my UCR project, I just need to rip it out and make it stand-alone.
Jiffers211
Posts: 4
Joined: 26 Jun 2017, 18:59

Re: Xbox Controller to Start Steam

27 Jun 2017, 11:55

I have a physical xbox controller.
We're going to be at an event where we can't bring a keyboard or mouse, so once the desktop is up, we have to be able to use the Xbox controller to start the game.
Sorry if it's still not clear, let me know any other information that might help!
So far, I have

#m::
Run steam://rungameid/374180
return

the first bit words to run off the keyboard. I just need it to not be the keyboard but the Xbox input.
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Xbox Controller to Start Steam

27 Jun 2017, 11:59

Oh so you do not need to remap the controller in any way (eg you don't need to do something like make button A report as button B), all you need to do is issue a command in response to button input.

ie it sounds to me like you could have a script which detects a button combo that you would never normally press in a game (eg A+B+X+Y) and start the game from that.
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Xbox Controller to Start Steam

27 Jun 2017, 12:01

Code: Select all

JoyID := 1	; Set this to the ID number of your XBox pad
str := JoyID "Joy"

Loop {
	if (GetKeyState(str "1") && GetKeyState(str "2") && GetKeyState(str "3") && GetKeyState(str "4")){
		Run steam://rungameid/374180
		Sleep 1000 ; Give you time to release the buttons - ie try and stop script from trying to launch game multiple times
	}
	Sleep 100
}
Jiffers211
Posts: 4
Joined: 26 Jun 2017, 18:59

Re: Xbox Controller to Start Steam

27 Jun 2017, 12:14

Thank you!
How do I locate the JoyID? Would that be in controls? I've been reading about Joy1-32 but I'm not sure what each one does.

- Taylor
Jiffers211
Posts: 4
Joined: 26 Jun 2017, 18:59

Re: Xbox Controller to Start Steam

28 Jun 2017, 11:57

JoyID := 1
str := JoyID "Joy"

Loop {
if (Joy1 && Joy6 && Joy7 && JoyU>0.5f && JoyV > 0.5f){
Run steam://rungameid/374180
Sleep 1000
}
Sleep 100
}


The controller I'm using is connected by USB. it's an XBox One controller.
I'm not getting any feedback from what the issue is... and I'm also not 100% sure what I should be looking at. With the no feedback, I'm not even sure if ID 1 is correct because I don't know if the Joy1 / Joy6 are correct, so troubleshooting with all of my variables up in the air ins't working too well, haha. Any other sources you could recommend? As in, what does the program call each of the individual buttons on the controller? I've found some saying what I have above, some saying "LButton down" but nothing I've done has worked yet.
Thank you so much for your help. I really appreciate it.

- Taylor
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Xbox Controller to Start Steam

28 Jun 2017, 12:12

As I said, download and run PJP JoyIDs.
It will tell you the IDs of all your sticks.

Your syntax is totally wrong, why did you change it from the syntax I showed you?
You need to use GetKeyState to get joystick states, you cannot just inspect a variable called "Joy1" - it does not exist.

JoyU>0.5f Apart from the aforementioned lack of GetKeyState, you are checking if the axis value is a floating point value (when it reports as integers from 0-100), and you have an f after the number, which is not valid syntax either.

Why try and change the syntax from the sample code at all? Even if you do not want A+B+X+Y to trigger the macro, just get that working first, THEN customize it to what you want.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 74 guests