Please help with a simple rapid fire

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

Please help with a simple rapid fire

Postby mikehell » Tue Mar 17, 2020 8:00 am

Hi guys, I recently buy my T2 and need some guidance, I know nothing about programing but i will try to learn.

I need a rapid fire that spam Xbox button X when that said button is pressed and stop when pressed a second time.

Also maybe you guys can add a way to activate/deactivate this with the xbox view button, if active uses the rapid fire, deactivated uses the normal behaviour of the button, thanks in advance and sorry for my bad english.
User avatar
mikehell
Staff Sergeant
Staff Sergeant
 
Posts: 14
Joined: Sun Jan 12, 2020 5:51 am

Re: Please help with a simple rapid fire

Postby Mad » Tue Mar 17, 2020 8:11 am

Code: Select all
#include <xb1.gph>
 
bool toggle;
bool spam_x;
 
main {
    if(event_active(XB1_VIEW)) toggle = !toggle;
 
    if(toggle && event_active(XB1_X)) spam_x = !spam_x;
 
    if(spam_x) combo_run(x);
}
 
combo x {
    set_val(XB1_X, 100);
    wait(60);
    set_val(XB1_X, 0);
    wait(60);
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: Please help with a simple rapid fire

Postby mikehell » Tue Mar 17, 2020 8:15 am

It works nicely, in case I need change toogle for keep pressing what do I need to change?
User avatar
mikehell
Staff Sergeant
Staff Sergeant
 
Posts: 14
Joined: Sun Jan 12, 2020 5:51 am

Re: Please help with a simple rapid fire

Postby Mad » Wed Mar 18, 2020 10:25 am

mikehell wrote:It works nicely, in case I need change toogle for keep pressing what do I need to change?

You want to hold view then tap x?
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
Mad
Major General
Major General
 
Posts: 4536
Joined: Wed May 22, 2019 5:39 am

Re: Please help with a simple rapid fire

Postby mikehell » Wed Mar 18, 2020 6:34 pm

Sorry if I didn't explain better, I mean instead of press X to activate and second press to deactivate just hold X for activate and release X for deactivate.
User avatar
mikehell
Staff Sergeant
Staff Sergeant
 
Posts: 14
Joined: Sun Jan 12, 2020 5:51 am

Re: Please help with a simple rapid fire

Postby J2Kbr » Wed Mar 18, 2020 6:39 pm

mikehell wrote:Sorry if I didn't explain better, I mean instead of press X to activate and second press to deactivate just hold X for activate and release X for deactivate.

Code: Select all
#include <xb1.gph>
 
main {
    if(get_val(XB1_X)) combo_run(x);
}
 
combo x {
    set_val(XB1_X, 100);
    wait(60);
    set_val(XB1_X, 0);
    wait(60);
}
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: Please help with a simple rapid fire

Postby mikehell » Wed Mar 18, 2020 10:47 pm

Muchas gracias!

Thank you!
User avatar
mikehell
Staff Sergeant
Staff Sergeant
 
Posts: 14
Joined: Sun Jan 12, 2020 5:51 am


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 154 guests