I got an interesting question here

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

I got an interesting question here

Postby alencroat » Wed Nov 10, 2021 8:01 pm

can you transform lets say RS click on xbox button to register as V key on keyboard press?
If so what would that look like.
Does my keyboard have to be connected to the titan two?
User avatar
alencroat
Lieutenant
Lieutenant
 
Posts: 320
Joined: Sun Oct 15, 2017 5:58 pm

Re: I got an interesting question here

Postby Mad » Wed Nov 10, 2021 9:47 pm

Yes with key_set
Don't need a keyboard connected.
https://www.consoletuner.com/wiki/index ... t2:key_set
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: I got an interesting question here

Postby alencroat » Wed Nov 10, 2021 11:02 pm

hmm I tried to code what I think works but didn't work: Ill show what I got.
Code: Select all
#include <keyboard.gph>
main {
//test
    set_val(BUTTON_6, 0.0);
     if(get_actual(BUTTON_6)) {
    combo_run(test);
    }
}
combo test{
    static uint8 i;
    const uint8 msg[] = {
        KEY_A,
    };
 
    key_set(msg[i], TRUE);
    wait(10);
 
    key_set(msg[i], FALSE);
    wait(100);
 
    if(++i == sizeof(msg)) i = 0;
}
  


hmm i even tryed this didnt work
Code: Select all
#include <keyboard.gph>
 
main {
    if(event_active (BUTTON_6)) {
        combo_run(HelloTitanTwo);}       
 
}
 
combo HelloTitanTwo {
    key_set(KEY_A, 100);
    wait(500);
    key_set(KEY_A, 0);
    wait(500);   
}


oh yea I forgot to say Im on pc using xbox controller trying to send a key function, by hitting button 6, which is RS click.
User avatar
alencroat
Lieutenant
Lieutenant
 
Posts: 320
Joined: Sun Oct 15, 2017 5:58 pm

Re: I got an interesting question here

Postby Mad » Thu Nov 11, 2021 8:50 pm

I should have mentioned since it's outputting as a controller you'd need to switch the protocol to USB HID.

If timing is critical then this probably wont help. If timing doesn't matter it takes around one second to switch protocols.

https://www.consoletuner.com/wiki/index ... rt_connect
Code: Select all
combo HelloTitanTwo {
    port_connect(PORT_USB_C, PROTOCOL_HID);
    wait(0);
    wait(1000); // can adjust this based on how long it takes to connect
    key_set(KEY_A, 100);
    wait(500);
    key_set(KEY_A, 0);
    wait(500);
    port_connect(PORT_USB_C, PROTOCOL_XB360);
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: I got an interesting question here

Postby alencroat » Fri Nov 12, 2021 2:59 am

ok ty sir I will try this

EDIT: yea works pretty good too bad it takes a bit to connect. Thank you
User avatar
alencroat
Lieutenant
Lieutenant
 
Posts: 320
Joined: Sun Oct 15, 2017 5:58 pm


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 123 guests