How to make a script press two buttons at the same time?

Gtuner IV general support. Operation, questions, updates, feature request.

How to make a script press two buttons at the same time?

Postby Mebc01 » Mon Nov 20, 2017 9:23 pm

Hello can anyone tell me how to make a script press two buttons at the same time? Im trying to make combos and one of the parts is pressing *LEFT + TRIANGLE* at the same time. Thank you. Also how to make it press more than two?

Edit: Also how do i use the -100.00 feature on the RS/R3/LS/L3? basically if i flick right analog stick to the left it will do a diffirent script than if i flicked it to the right. Thank you
User avatar
Mebc01
Sergeant First Class
Sergeant First Class
 
Posts: 21
Joined: Wed Sep 27, 2017 5:07 am

Re: How to make a script press two buttons at the same time?

Postby Sillyasskid » Mon Nov 20, 2017 11:14 pm

Mebc01 wrote:Im trying to make combos and one of the parts is pressing *LEFT + TRIANGLE* at the same time.

Code: Select all
#include <ps4.gph>
main{
    if(event_active(PS4_CROSS)) {
        combo_run(combo_1);}
} //main end
combo combo_1 {
    set_val(PS4_TRIANGLE, 100);
    set_val(PS4_LEFT, 100);
    wait(500); // Time PS4_TRIANGLE & PS4_LEFT should be held in milliseconds.
    set_val(PS4_TRIANGLE, 0);
    set_val(PS4_LEFT, 0);
    wait(200); // Release time in milliseconds.
}

Mebc01 wrote:Also how to make it press more than two?

Code: Select all
#include <ps4.gph>
main{
    if(event_active(PS4_CROSS)) {
        combo_run(combo_1);}
} //main end
combo combo_1 {
    set_val(PS4_TRIANGLE, 100); //One Button
    set_val(PS4_LEFT, 100); // Two Button's
    set_val(PS4_SQUARE, 100); // Three Button's etc....
    wait(500); // Hold time in milliseconds.
    set_val(PS4_TRIANGLE, 0);
    set_val(PS4_LEFT, 0);
    set_val(PS4_SQUARE , 0);
    wait(200); // Release time in milliseconds.
}

Mebc01 wrote:how do i use the -100.00 feature on the RS/R3/LS/L3? basically if i flick right analog stick to the left it will do a diffirent script than if i flicked it to the right.

Code: Select all
#include <ps4.gph>
main {
    if (get_actual(PS4_RX) > 90f) {
        combo_run(Combo_Right);}
    if (get_actual(PS4_RX) < -90f) {
        combo_run(Combo_Left);}
    if (get_actual(PS4_RY) > 90f) {
        combo_run(Combo_Down);}
    if (get_actual(PS4_RY) < -90f) {
        combo_run(Combo_Up);}
} //main end
combo    Combo_Right {
    //insert script   
    printf("RIGHT STICK RIGHT"); wait(0);wait(300); // Remove
}
combo    Combo_Left {
    //insert script       
    printf("RIGHT STICK LEFT"); wait(0);wait(300); // Remove
}
combo    Combo_Down {
    //insert script       
    printf("RIGHT STICK DOWN"); wait(0);wait(300); // Remove
}
combo    Combo_Up {
    //insert script       
    printf("RIGHT STICK UP"); wait(0);wait(300); // Remove
}
User avatar
Sillyasskid
Captain
Captain
 
Posts: 574
Joined: Sat May 14, 2016 3:07 am

Re: How to make a script press two buttons at the same time?

Postby Mebc01 » Tue Nov 21, 2017 4:00 pm

Thank you. Can you also explain how to make it run a script if I press Multiple buttons at the same time such as R2 and Triangle? Is it possible to make a script run if you press buttons after each other such as SQUARE, SQUARE, X ?
thanks again, thank you so much.
User avatar
Mebc01
Sergeant First Class
Sergeant First Class
 
Posts: 21
Joined: Wed Sep 27, 2017 5:07 am

Re: How to make a script press two buttons at the same time?

Postby Sillyasskid » Tue Nov 21, 2017 10:38 pm

Mebc01 wrote:Can you also explain how to make it run a script if I press Multiple buttons at the same time such as R2 and Triangle?

Code: Select all
#include <ps4.gph>
main
{
    if(get_actual(PS4_R2) && get_actual(PS4_TRIANGLE))
    {
        if (time_active(PS4_R2) == 0 || time_active(PS4_TRIANGLE) == 0)
        {
            combo_run(Combo1);
        }
    }
}
combo Combo1
{
    printf("Combo1"); wait(0); wait(200); // Remove
    //insert script
}

Mebc01 wrote:Is it possible to make a script run if you press buttons after each other such as SQUARE, SQUARE, X ?

Code: Select all
#include <ps4.gph>
bool flag;
main
{
    if (getLastButtonPressed() == PS4_SQUARE && event_active(PS4_SQUARE))
    {
        flag = TRUE;
    }
    if (getLastButtonPressed() == PS4_SQUARE && event_active(PS4_CROSS) && flag == TRUE)
    {
        combo_run(combo2);
    }   
    if (getLastButtonPressed() != PS4_SQUARE && flag == TRUE)
    {
        flag = FALSE;
    }   
}
combo combo2
{
printf("Combo2"); wait(0); wait(200); // Remove
    //insert script
}
uint8 getLastButtonPressed()
{
    uint8 i, last = BUTTON_1;
    for (i=BUTTON_2; i<=BUTTON_21; ++i)
    {
        if (time_release(i) < time_release(last))
        {
            last = i;
        }
    }
    return(last);
}

Are you having difficulties understanding these scripts? I'm not trying to overwhelm you,
So if you need more help, I can break the scripts down further, so its easier to understand.
User avatar
Sillyasskid
Captain
Captain
 
Posts: 574
Joined: Sat May 14, 2016 3:07 am

Re: How to make a script press two buttons at the same time?

Postby Mebc01 » Wed Nov 22, 2017 5:12 pm

Please break it down further, also:

- is it possible to write a script where you press buttons after each other in sequence, and holding the last button would run the combo, but then letting go would stop it? Such as I press *SQUARE SQUARE X* in sequence then I hold down *LEFT or RIGHT* depending on where my character is on the screen and the script would run on either side?
- Also how do I make it stop a Combo ?
User avatar
Mebc01
Sergeant First Class
Sergeant First Class
 
Posts: 21
Joined: Wed Sep 27, 2017 5:07 am


Return to Gtuner IV Support

Who is online

Users browsing this forum: No registered users and 76 guests