Keystroke on Buttonpress on PC

GPC2 script programming for Titan Two. Code examples, questions, requests.

Keystroke on Buttonpress on PC

Postby yohimbe » Sat Apr 13, 2019 11:24 pm

Is it possible to assign buttonpress on PC with XBOX Controller attached to send keystroke to PC.
So when I press X Button PC gets input that the Num1 key has been pressed.

Possible?
User avatar
yohimbe
Sergeant Major
Sergeant Major
 
Posts: 84
Joined: Sun Mar 01, 2015 7:27 pm

Re: Keystroke on Buttonpress on PC

Postby antithesis » Sun Apr 14, 2019 1:55 am

Perhaps via a PC app that remaps button bindings on an Xbox controller.

I don't think you can do this on T2, it works the other way around by translating m/kb input to controller buttons.
Official Australian retailer for Titan One, Titan Two and XIM APEX at Mod Squad
User avatar
antithesis
Colonel
Colonel
 
Posts: 1912
Joined: Sat May 28, 2016 10:45 pm

Re: Keystroke on Buttonpress on PC

Postby Buffy » Sun Apr 14, 2019 4:51 am

It's possible, set your output to HID, and use code like this:

Code: Select all
 
 
#include <xb1.gph>
#include <keyboard.gph>
 
 
main {
        key_set(KEY_W, (int)get_actual(XB1_X)); // W is pressed if XB1_X is pressed
}
 
ConsoleTuner Support Team || Discord || Custom Scripts
User avatar
Buffy
Lieutenant
Lieutenant
 
Posts: 422
Joined: Wed Jul 20, 2016 5:23 am

Re: Keystroke on Buttonpress on PC

Postby antithesis » Sun Apr 14, 2019 10:56 am

Buffy to the rescue!

You learn something new every day...
Official Australian retailer for Titan One, Titan Two and XIM APEX at Mod Squad
User avatar
antithesis
Colonel
Colonel
 
Posts: 1912
Joined: Sat May 28, 2016 10:45 pm


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 147 guests