Can some make me the this script

GPC1 script programming for Titan One. Code examples, questions, requests.

Can some make me the this script

Postby Jas8585 » Tue Feb 21, 2017 11:15 pm

Hi can you make me a script

If I double press LB runs combo 1
If I double press RB runs combo 2
If I press RB runs combo 3
If I press X runs combo 4
If I press A runs combo 5
If I press B run combo 6

And I will add all the combos in myself.Hope this makes sense.
Thank your for your help
User avatar
Jas8585
Sergeant First Class
Sergeant First Class
 
Posts: 19
Joined: Thu Feb 16, 2017 9:40 pm

Re: Can some make me the this script

Postby xenologer » Wed Feb 22, 2017 12:32 pm

Here's the hard part:
Code to Detect DoubleTap for LB
DoubleTap for RB vs SingleTap for RB

The easy parts for (X, A, B) you can fill out yourself

200milliseconds time limit to qualify as a DoubleTap

Code: Select all
 
//speed between presses to qualify as a doubletap
//200ms
define tapspeed=200;
 
int rbtimer=0, lbtimer=0;
int rbprev=0;
main {
 
    //detect LB doubletap
    if(event_press(XB1_LB)){
        if(lbtimer<tapspeed){
            //LB doubletap detected
            //do **STUFF** here
 
        }
    }
    lbtimer=get_ptime(XB1_LB);
 
 
    //detect RB doubletap/singletap
    if(event_press(XB1_RB)){
        if(rbprev){
            if(rbtimer<tapspeed){
                rbprev=0;
                //RB doubletap detected
                //do **STUFF** here
 
            }
        }else{
            rbprev=1;
        }
    }
    rbtimer=get_ptime(XB1_RB);
    if(rbprev && rbtimer>tapspeed){
        rbprev=0;
        //RB singlepress default
        //do **STUFF** here
 
    }
 
}
 
 
 
 
User avatar
xenologer
Command Sergeant Major
Command Sergeant Major
 
Posts: 147
Joined: Thu Dec 29, 2016 12:31 am

Re: Can some make me the this script

Postby Jas8585 » Wed Feb 22, 2017 3:12 pm

Sorry new to this how do I put the rest of script in
User avatar
Jas8585
Sergeant First Class
Sergeant First Class
 
Posts: 19
Joined: Thu Feb 16, 2017 9:40 pm

Re: Can some make me the this script

Postby The_Rabid_Taco » Wed Feb 22, 2017 3:49 pm

What is the rest of the script? I've posted below the rest of the calls to the combos, but without knowing what they are it is as far as we can go with any example.

Code: Select all
 
//speed between presses to qualify as a doubletap
//200ms
define tapspeed=200;
 
int rbtimer=0, lbtimer=0;
int rbprev=0;
main {
 
    //detect LB doubletap
    if(event_press(XB1_LB)){
        if(lbtimer<tapspeed){
            //LB doubletap detected
            //do **STUFF** here
 
        }
    }
    lbtimer=get_ptime(XB1_LB);
 
 
    //detect RB doubletap/singletap
    if(event_press(XB1_RB)){
        if(rbprev){
            if(rbtimer<tapspeed){
                rbprev=0;
                //RB doubletap detected
                //do **STUFF** here
 
            }
        }else{
            rbprev=1;
        }
    }
    rbtimer=get_ptime(XB1_RB);
    if(rbprev && rbtimer>tapspeed){
        rbprev=0;
        //RB singlepress default
        //do **STUFF** here
 
    }
 
    if (event_press(XB1_X)) {
        combo_run(<Your Combo Here>);
    }
 
    if (event_press(XB1_A)) {
        combo_run(<Your Combo Here>);
    }
 
    if (event_press(XB1_B)) {
        combo_run(<Your Combo Here>);
    }
}


Please let us know if you require more assistance, but we would need to know more information as well to get beyond this point.
User avatar
The_Rabid_Taco
Major
Major
 
Posts: 1066
Joined: Wed Mar 16, 2016 6:04 pm
Location: Pensacola, FL

Re: Can some make me the this script

Postby J2Kbr » Wed Feb 22, 2017 5:59 pm

Hi Jas, I replied your PM early today with the script, here is a copy:
Code: Select all
int dt1_stage = 0;
int dt1_timing;
 
int dt2_stage = 0;
int dt2_timing;
 
main {
    // If I double press LB runs combo 1
    if(dt1_stage == 0) {
        if(get_val(XB1_LB)) dt1_stage = 1;
    } else if(dt1_stage == 1) {
        if(!get_val(XB1_LB)) { dt1_timing = 0; dt1_stage = 2; }
    } else if(dt1_stage == 2) {
        if(get_val(XB1_LB)) { dt1_stage = 1; combo_run(Combo1); }
        dt1_timing = dt1_timing + get_rtime();
        if(dt1_timing > 100) dt1_stage = 0;
    }
 
    // If I double press RB runs combo 2
    if(dt2_stage == 0) {
        if(get_val(XB1_RB)) dt2_stage = 1;
    } else if(dt2_stage == 1) {
        if(!get_val(XB1_RB)) { dt2_timing = 0; dt2_stage = 2; }
    } else if(dt2_stage == 2) {
        if(get_val(XB1_RB)) { dt2_stage = 1; combo_run(Combo2); }
        dt2_timing = dt2_timing + get_rtime();
        if(dt2_timing > 100) dt2_stage = 0;
    }
 
    // If I press RB runs combo 3
    if(event_press(XB1_RB)) {
        combo_run(Combo3);
    }
 
    // If I press X runs combo 4
    if(event_press(XB1_X)) {
        combo_run(Combo4);
    }
 
    // If I press A runs combo 5
    if(event_press(XB1_A)) {
        combo_run(Combo5);
    }
 
    // If I press B run combo 6
    if(event_press(XB1_B)) {
        combo_run(Combo6);
    }
}
 
combo Combo1 {
    //
    // combo code here
    //
}
 
combo Combo2 {
    //
    // combo code here
    //
}
 
combo Combo3 {
    //
    // combo code here
    //
}
 
combo Combo4 {
    //
    // combo code here
    //
}
 
combo Combo5 {
    //
    // combo code here
    //
}
 
combo Combo6 {
    //
    // combo code here
    //
}
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: Can some make me the this script

Postby xenologer » Thu Feb 23, 2017 2:59 am

J2Kbr
looking at the latest script you posted
It is unclear to me what prevents intermediate Presses of RB in the process of performing a RB doubletap (combo2), from simultaneously triggering a RB singletap (combo 3)

OP didn't state it explicitly, but I'd assume the RB single should be 'blocked' from triggering temporarially until the script can be certain it wasn't going to become a RB doubletap.

Thinking that your Conditional for combo 3 needs to monitor "dt2_stage" and make sure the doubletap code isn't currently busy, in addition to the event_press. Maybe you forgot to add that in?



P.S. I think my doubletap state logic is prettier.
User avatar
xenologer
Command Sergeant Major
Command Sergeant Major
 
Posts: 147
Joined: Thu Dec 29, 2016 12:31 am

Re: Can some make me the this script

Postby Jas8585 » Thu Feb 23, 2017 7:06 am

hi

as you can see from script i have put in same combos but when i double press RB it is running combo 3 not combo 2 i am pressing it quickly can you help thank you so much for your time

Code: Select all
int dt1_stage = 0;
int dt1_timing;
 
int dt2_stage = 0;
int dt2_timing;
 
main {
    // If I double press LB runs combo 1
    if(dt1_stage == 0) {
        if(get_val(XB1_LB)) dt1_stage = 1;
    } else if(dt1_stage == 1) {
        if(!get_val(XB1_LB)) { dt1_timing = 0; dt1_stage = 2; }
    } else if(dt1_stage == 2) {
        if(get_val(XB1_LB)) { dt1_stage = 1; combo_run(Combo1); }
        dt1_timing = dt1_timing + get_rtime();
        if(dt1_timing > 100) dt1_stage = 0;
    }
 
    // If I double press RB runs combo 2
    if(dt2_stage == 0) {
        if(get_val(XB1_RB)) dt2_stage = 1;
    } else if(dt2_stage == 1) {
        if(!get_val(XB1_RB)) { dt2_timing = 0; dt2_stage = 2; }
    } else if(dt2_stage == 2) {
        if(get_val(XB1_RB)) { dt2_stage = 1; combo_run(Combo2); }
        dt2_timing = dt2_timing + get_rtime();
        if(dt2_timing > 100) dt2_stage = 0;
    }
 
    // If I press RB runs combo 3
    if(event_press(XB1_RB)) {
        combo_run(Combo3);
    }
 
    // If I press X runs combo 4
    if(event_press(XB1_X)) {
        combo_run(Combo4);
    }
 
    // If I press A runs combo 5
    if(event_press(XB1_A)) {
        combo_run(Combo5);
    }
 
    // If I press B run combo 6
    if(event_press(XB1_B)) {
        combo_run(Combo6);
    }
}
 
combo Combo1 {
   set_val(XB1_RX, 33);
    wait(20);
    set_val(XB1_RX, 72);
    wait(10);
    set_val(XB1_RX, 100);
    wait(120);
    set_val(XB1_RX, 67);
    wait(10);
    set_val(XB1_RX, 0);
    wait(190);
    set_val(XB1_RY, 30);
    wait(20);
    set_val(XB1_RY, 100);
    wait(120);
    set_val(XB1_RY, -60);
    wait(10);
    set_val(XB1_RY, 0);
}
 
combo Combo2 {
set_val(XB1_RX, 41);
    wait(10);
    set_val(XB1_RX, 72);
    wait(20);
    set_val(XB1_RX, 100);
    wait(230);
    set_val(XB1_RX, -39);
    wait(10);
    set_val(XB1_RX, 0);
    wait(290);
    set_val(XB1_RY, -44);
    wait(10);
    set_val(XB1_RY, -73);
    wait(20);
    set_val(XB1_RX, 31);
    set_val(XB1_RY, -100);
    wait(90);
    set_val(XB1_RX, 0);
    set_val(XB1_RY, -100);
    wait(130);
    set_val(XB1_RY, 0);
}   
 
combo Combo3 {
    set_val(XB1_X, 100);
    wait(10);
    set_val(XB1_RB, 100);
    set_val(XB1_X, 100);
    wait(180);
    set_val(XB1_RB, 100);
    set_val(XB1_X, 0);
    wait(10);
    set_val(XB1_RB, 0);
}
 
combo Combo4 {
    //
    // combo code here
    //
}
 
combo Combo5 {
    //
    // combo code here
    //
}
 
combo Combo6 {
    //
    // combo code here
    //
}
[/quote]
User avatar
Jas8585
Sergeant First Class
Sergeant First Class
 
Posts: 19
Joined: Thu Feb 16, 2017 9:40 pm

Re: Can some make me the this script

Postby xenologer » Thu Feb 23, 2017 7:27 am

...Yeah, I thought it looked bugged
Try copying your combos and modifications into the one I wrote instead (the earlier script)
I left comments (green text: do **STUFF** here) that mark where you're supposed to plug in the combo_run() calls
User avatar
xenologer
Command Sergeant Major
Command Sergeant Major
 
Posts: 147
Joined: Thu Dec 29, 2016 12:31 am

Re: Can some make me the this script

Postby Jas8585 » Thu Feb 23, 2017 7:39 am

I tryed that. I was getting errors when I was build script. must be something iam doing wrong.
Thank your for your help
User avatar
Jas8585
Sergeant First Class
Sergeant First Class
 
Posts: 19
Joined: Thu Feb 16, 2017 9:40 pm

Re: Can some make me the this script

Postby xenologer » Thu Feb 23, 2017 8:03 am

:whatever:

did your cut and paste attempt look anything close to this?:
because I know this one compiles

Code: Select all
 
//speed between presses to qualify as a doubletap
//200ms
define tapspeed=200;
 
int rbtimer=0, lbtimer=0;
int rbprev=0;
main {
 
    //detect LB doubletap
    if(event_press(XB1_LB)){
        if(lbtimer<tapspeed){
            //LB doubletap detected
            //do **STUFF** here
            combo_run(c1);
 
        }
    }
    lbtimer=get_ptime(XB1_LB);
 
 
    //detect RB doubletap/singletap
    if(event_press(XB1_RB)){
        if(rbprev){
            if(rbtimer<tapspeed){
                rbprev=0;
                //RB doubletap detected
                //do **STUFF** here
                combo_run(c2);
 
            }
        }else{
            rbprev=1;
        }
    }
    rbtimer=get_ptime(XB1_RB);
    if(rbprev && rbtimer>tapspeed){
        rbprev=0;
        //RB singlepress default
        //do **STUFF** here
        combo_run(c3);
 
    }
 
     if (event_press(XB1_X)) {
        combo_run(c4);
    }
 
    if (event_press(XB1_A)) {
        combo_run(c5);
    }
 
    if (event_press(XB1_B)) {
        combo_run(c6);
    }
 
 
}
 
 
 
 combo c1{
 
 }
 
 
 combo c2{
 
 }
 
 
 combo c3{
 
 }
 
 
 combo c4{
 
 }
 
 
 combo c5{
 
 }
 
 
 combo c6{
 
 }
 
User avatar
xenologer
Command Sergeant Major
Command Sergeant Major
 
Posts: 147
Joined: Thu Dec 29, 2016 12:31 am

Next

Return to GPC1 Script Programming

Who is online

Users browsing this forum: No registered users and 79 guests

cron