HID Examples

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

HID Examples

Postby Exx » Sat Jul 31, 2021 2:45 am

Hello,

Long time lurker here! Im familiar with making all my own controller scripts but now I'm particularly interested in using my Titan 2 just for keyboard and mouse. I've looked at the few examples here and still a bit confused. im just looking to get a new little snippet section for usb hid. Does anyone have an example of just a bunny hop toggle or a burst fire toggle combo. :innocent_smile_1:
User avatar
Exx
Private First Class
Private First Class
 
Posts: 3
Joined: Thu Apr 25, 2019 9:11 am

Re: HID Examples

Postby Exx » Tue Aug 10, 2021 11:51 am

I've got this figured out had to do some forum diving but found what i was looking for.

Next what I'm looking for is just to incorporate key time held with a key status. Lets just say for Turboloot. How do I set the time with HID.
elapsed_time?
output_time?
I want to hold the e button for 500 milli before i spam my e key.
Thanks in advance
User avatar
Exx
Private First Class
Private First Class
 
Posts: 3
Joined: Thu Apr 25, 2019 9:11 am

Re: HID Examples

Postby Mad » Tue Aug 10, 2021 12:00 pm

Yes with elapsed_time.
Example:
Code: Select all
#include <keyboard.gph>
uint32 e_timer;
main {
    if(key_status(KEY_E)) {
        if(elapsed_time() && ++e_timer >= 500) {
            combo_run(spam_e);
        }
    }
    else e_timer = 0;
}
combo spam_e {
    key_set(KEY_E, 1);
    wait(20);
    key_set(KEY_E, 0);
    wait(20);
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
Mad
Major General
Major General
 
Posts: 4533
Joined: Wed May 22, 2019 5:39 am

Re: HID Examples

Postby Exx » Wed Aug 11, 2021 1:11 am

Thanks Mad!
User avatar
Exx
Private First Class
Private First Class
 
Posts: 3
Joined: Thu Apr 25, 2019 9:11 am


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 86 guests