Need simple script (maybe with condition ?)

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

Need simple script (maybe with condition ?)

Postby Solid_Pliskin » Thu Sep 20, 2018 7:15 pm

Hello,

Someone can help me to do a simple script for T2 with Xbox controller on PS4.

Like many games take into account Left and Right Touchpad press, I would like to have:

- Swap View Button with Touchpad Press (but it's already done by default in T2 ^^).
- View Button + LB = Left Touchpad Press
- View Button + RB = Right Touchpad Press

But if I do this in game (View + LB or RB), the script risk to execute first the touchpad press... (example like open the map in Horizon). So I would like there to be a condition to only execute the Touchpad Press if I tap once the view button (maybe with below a period time ?), and when I wan to execute a Left or Right Touchpad press (View + LB or RB), the script don't execute first the Touchpad Press. (I do not know if I'm pretty clear, Sorry if it's not the case ^^)


Is it possible ? I would really like to keep these combos keys to integrate it into another script.


Thank you for your help !
User avatar
Solid_Pliskin
Corporal
Corporal
 
Posts: 5
Joined: Thu Sep 20, 2018 6:49 pm

Re: Need simple script (maybe with condition ?)

Postby J2Kbr » Fri Sep 21, 2018 9:50 am

Welcome to our forums.

Yes, what you are requesting is possible, please give a try:
Code: Select all
main {
    // View Button + LB = Left Touchpad Press
    if(get_val(BUTTON_2) && get_val(BUTTON_7)){
        set_val(POINT_1_X, -75.0);
        set_val(POINT_1_Y, 0.0);
        set_val(BUTTON_19, 100.0);
        set_val(BUTTON_2, 100.0);
    }
 
    // View Button + RB = Right Touchpad Press
    if(get_val(BUTTON_2) && get_val(BUTTON_7)){
        set_val(POINT_1_X, 75.0);
        set_val(POINT_1_Y, 0.0);
        set_val(BUTTON_19, 100.0);
        set_val(BUTTON_2, 100.0);
    }
}
 
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: Need simple script (maybe with condition ?)

Postby Psebcool » Fri Sep 21, 2018 12:48 pm

It's not rather Button_4 instead Button_7 for RB ?
Psebcool
Sergeant Major
Sergeant Major
 
Posts: 73
Joined: Mon Jun 22, 2015 7:41 pm

Re: Need simple script (maybe with condition ?)

Postby Solid_Pliskin » Fri Sep 21, 2018 1:23 pm

Thanks bro' and Thanks J2Kbr, I will try it !
User avatar
Solid_Pliskin
Corporal
Corporal
 
Posts: 5
Joined: Thu Sep 20, 2018 6:49 pm

Re: Need simple script (maybe with condition ?)

Postby Solid_Pliskin » Sat Sep 22, 2018 12:16 am

Okay, seems not working with View button like this:

Code: Select all
    // Hold View + press LB = Left Touchpad Press.
    if(get_val(BUTTON_2) && get_val(BUTTON_7)){
        set_val(BUTTON_7, 0.0);
        set_val(POINT_1_X, -75.0);
        set_val(POINT_1_Y, 0.0);
        set_val(BUTTON_19, 100.0);
        set_val(BUTTON_2, 100.0);
    }
 
    // Hold View + press RB = Right Touchpad Press.
    if(get_val(BUTTON_2) && get_val(BUTTON_4)){
        set_val(BUTTON_4, 0.0);
        set_val(POINT_1_X, 75.0);
        set_val(POINT_1_Y, 0.0);
        set_val(BUTTON_19, 100.0);
        set_val(BUTTON_2, 100.0);
    }


But the script works if I change View Button to Left Stick CLick, like this:

Code: Select all
    // Hold LS + press LB = Left Touchpad Press.
    if(get_val(BUTTON_9) && get_val(BUTTON_7)){
        set_val(BUTTON_7, 0.0);
        set_val(POINT_1_X, -75.0);
        set_val(POINT_1_Y, 0.0);
        set_val(BUTTON_19, 100.0);
        set_val(BUTTON_2, 100.0);
    }
 
    // Hold LS + press RB = Right Touchpad Press.
    if(get_val(BUTTON_9) && get_val(BUTTON_4)){
        set_val(BUTTON_4, 0.0);
        set_val(POINT_1_X, 75.0);
        set_val(POINT_1_Y, 0.0);
        set_val(BUTTON_19, 100.0);
        set_val(BUTTON_2, 100.0);
    }


I think it don't works because View Button is natively swapped with Touchpad Click maybe ? Anyway to fix this ? I would like to keep View Button to do this combos.

Otherwise, maybe to do a script under this structure (just an idea):
- Only one tap on Button_2 (View button) = Touchpad click (like the native swap on T2)
- Hold Button_2 + tap on Button_7 = Left Touchpad Click
- Hold Button_2 + tap on Button_4 = Right Touchpad Click

The tip is when I will hold Button_2, the native swap on T2 (one tap) must not be triggered.

Thank you !

EDIT: The script finally seems to work with most of the games. I tried it first with Bloodborne, the only game (that I have) that doesn't seem to work with this script. So sorry ! (But if you have a script for the structure idea above, I take it for universal game compatibility ^^). Thanks !
User avatar
Solid_Pliskin
Corporal
Corporal
 
Posts: 5
Joined: Thu Sep 20, 2018 6:49 pm

Re: Need simple script (maybe with condition ?)

Postby J2Kbr » Sat Sep 22, 2018 11:59 am

Very happy we are making progress! :) and you are right about BUTTON_2. To fix use, instead of get_val(), get_actual().
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: Need simple script (maybe with condition ?)

Postby Solid_Pliskin » Sat Sep 22, 2018 4:07 pm

Okay It's done and works in all games !

I added this for Button_2:
Code: Select all
 
    set_val(BUTTON_2, 0.0);
    if(is_active(BUTTON_2) && time_active(BUTTON_2) <= 100) {
        set_val(BUTTON_2, 100.0);
    } 
 


And modify combos like this:

Code: Select all
     // Hold View + press LB = Left Touchpad Press.
    if(get_actual(BUTTON_2) && get_val(BUTTON_7)){
        set_val(BUTTON_7, 0.0);
        set_val(POINT_1_X, -75.0);
        set_val(POINT_1_Y, 0.0);
        set_val(BUTTON_19, 100.0);
        set_val(BUTTON_2, 100.0);
    }
 
    //  Hold View + press RB = Right Touchpad Press.
    if(get_actual(BUTTON_2) && get_val(BUTTON_4)){
        set_val(BUTTON_4, 0.0);
        set_val(POINT_1_X, 75.0);
        set_val(POINT_1_Y, 0.0);
        set_val(BUTTON_19, 100.0);
        set_val(BUTTON_2, 100.0);
    }
 



Thank you for your help ! :smile0203:
User avatar
Solid_Pliskin
Corporal
Corporal
 
Posts: 5
Joined: Thu Sep 20, 2018 6:49 pm


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 87 guests

cron