Script Needed

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

Script Needed

Postby Theonewhocaresnot » Mon Dec 10, 2018 12:58 pm

Good Morning,

I am looking for a script that can do a couple of things. First, I need the the script to hit the X button on a PS4 controller at 1 press a second repeatedly. The next thing I need is for the ability to press the R1 button to raise the speed of the of the X button press by .01 a second and the L1 to lower the the speed of the X button press by .01.I don't know if there is a way for you to save the speed of the button press once you get it to where you need it to be or if the T2 does that automatically.

I guess to turn on the function you would hold the X button down for 2 seconds and to turn off the function again hold for 2 secs. Unless there is a more simpler way of doing that.

Lastly I need to the script to do what some sniper games do. Press the L2 button half way to scope in and to search and assess. Then if the L2 button is fully pressed to press the L3 button down (to hold breath) so that a Snipers bullet can fly.

Thank you in advance.
Respectfully,
Storm
User avatar
Theonewhocaresnot
Staff Sergeant
Staff Sergeant
 
Posts: 10
Joined: Thu Aug 17, 2017 2:45 pm

Re: Script Needed

Postby Theonewhocaresnot » Tue Dec 11, 2018 3:38 am

Anyone, anyone?????
User avatar
Theonewhocaresnot
Staff Sergeant
Staff Sergeant
 
Posts: 10
Joined: Thu Aug 17, 2017 2:45 pm

Re: Script Needed

Postby J2Kbr » Tue Dec 11, 2018 4:31 pm

Please try this:
Code: Select all
/*
I am looking for a script that can do a couple of things. First, I need the the
script to hit the X button on a PS4 controller at 1 press a second repeatedly.
The next thing I need is for the ability to press the R1 button to raise the
speed of the of the X button press by .01 a second and the L1 to lower the the
speed of the X button press by .01.I don't know if there is a way for you to
save the speed of the button press once you get it to where you need it to be
or if the T2 does that automatically.
*/

 
int16 speed = 1000;
 
main {
    if(event_active(BUTTON_4)) {
        speed += 10;
    }
    if(event_active(BUTTON_7)) {
        speed -= 10;
        if(speed < 0) speed = 0;
    }
    combo_run(PressCross);
}
 
combo PressCross {
    set_val(BUTTON_16, 100.0);
    wait(50);
    wait(speed);
}
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: Script Needed

Postby Theonewhocaresnot » Wed Dec 12, 2018 1:27 am

J2kbr,

Thank you for looking into this for me. I really do appreciate it. I loaded this script on my Titan 2 memory slot 5. I pressed the Cross button (X on playstation) for a couple of sec to activate it and it didn't activate. I am not sure what I did for it not to activate. I am sure once I get it to activate it will work perfectly for me.

Thank you again
Respectfully,
Storm
User avatar
Theonewhocaresnot
Staff Sergeant
Staff Sergeant
 
Posts: 10
Joined: Thu Aug 17, 2017 2:45 pm

Re: Script Needed

Postby J2Kbr » Wed Dec 12, 2018 8:24 am

The first code has no toggle to activate/deactivate (would run as soon as it loads). However, I added toggle on/off with CROSS button, as you described:
Code: Select all
/*
I am looking for a script that can do a couple of things. First, I need the the
script to hit the X button on a PS4 controller at 1 press a second repeatedly.
The next thing I need is for the ability to press the R1 button to raise the
speed of the of the X button press by .01 a second and the L1 to lower the the
speed of the X button press by .01.I don't know if there is a way for you to
save the speed of the button press once you get it to where you need it to be
or if the T2 does that automatically.
*/

 
bool toggle;
int16 speed = 1000;
 
main {
    if(event_active(BUTTON_16)) {
        toggle = !toggle;
    }
    if(toggle) {
        if(event_active(BUTTON_4)) {
            speed += 10;
        }
        if(event_active(BUTTON_7)) {
            speed -= 10;
            if(speed < 0) speed = 0;
        }
        combo_run(PressCross);
    } else combo_stop(PressCross);
}
 
combo PressCross {
    set_val(BUTTON_16, 100.0);
    wait(50);
    wait(speed);
}
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: Script Needed

Postby Theonewhocaresnot » Wed Dec 12, 2018 2:44 pm

Okay, so maybe I am doing something wrong here. I am not sure that I am doing it right.

I select all your script and then right click to copy. I go to File, select new, select Create Empty GPC file. I right click the mouse and paste the script. I go back to file and select save as and name it. I drag the file now created from my desktop and select the memory slot to drop it in (slot 3) and from there its not like the past drag and drops.

On the T2 the slot says Not Defined not sure why but okay. The next thing I do is exit the Gtuner IV 2 software and go connect it to my ps4. I select 3 memory slot and press the x button and nothing happens. So, I am guessing that I did something wrong. Any and all help would be much appreciated.
User avatar
Theonewhocaresnot
Staff Sergeant
Staff Sergeant
 
Posts: 10
Joined: Thu Aug 17, 2017 2:45 pm

Re: Script Needed

Postby Scachi » Wed Dec 12, 2018 2:50 pm

Did you do the first time configuration as stated in the manual that came with the T2 ?
Without this your scripts may have no effetcs if you are using the newer DS4 controller with the lightbar visible through the touchpad
https://www.consoletuner.com/wiki/index ... figuration

First-time Configuration

On PlayStation 4, enable wired communication:
1:Settings → Devices → Controllers → Communication Method: Use USB Cable.
Configure the Output Protocol of the Titan Two to USB Automatic or USB PlayStation 4.


1: has to be done on the PS4 system , not in GTuner IV/Titan Two
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Script Needed

Postby Theonewhocaresnot » Thu Dec 13, 2018 12:31 pm

Scachi,

Thank you for your reply to me. Yes, I did do all those things two years ago when I first got my T2. I just haven't used it that much. When ever I have used it, I just used the game packs for the device and have done the drag and drop. I never did copy a script and try to put it into the T2. That is why I went step by step to see if I did something wrong and if I did miss a step to have someone tell me where I went wrong so I can adjust my course.
User avatar
Theonewhocaresnot
Staff Sergeant
Staff Sergeant
 
Posts: 10
Joined: Thu Aug 17, 2017 2:45 pm

Re: Script Needed

Postby Scachi » Thu Dec 13, 2018 12:53 pm

Theonewhocaresnot wrote:Okay, so maybe I am doing something wrong here. I am not sure that I am doing it right.

I select all your script and then right click to copy. I go to File, select new, select Create Empty GPC file. I right click the mouse and paste the script. I go back to file and select save as and name it. I drag the file now created from my desktop and select the memory slot to drop it in (slot 3) and from there its not like the past drag and drops.

On the T2 the slot says Not Defined not sure why but okay. The next thing I do is exit the Gtuner IV 2 software and go connect it to my ps4. I select 3 memory slot and press the x button and nothing happens. So, I am guessing that I did something wrong. Any and all help would be much appreciated.

Looks like you are doing that correctly.

"Not Defined" is caused by the script, it has no "#pragma" line in it that defines its title, version number, author
You can do "Create Minimum GPC file" instead of empty and you will get that line. Keep this line and delete everything else, paste the code into it and save it.
Hit "F7" or "Compiler->Compile" and check the output panel for errors.
If it reports success you are ready to go to do the drag and drop.
The F7 / Compile script is optional. You get the same output when you do the drag and drop only onto a memory Slot with a .gpc script.

You can check the function of the script itself via the "Device Monitor".
Click on it to open it and right-click on the Slot in the "Device Memory Slots" to "Load Memory Slot" (or left click on the big bold Number of the slot)
If you now press cross on your connected controller once you should be able to see the Cross / Button_16 being pressed (set to 100) for a (very) short time each second.
you can use a longer time in this line: wait(50);
set it to :wait(200); will result in the button being pressed for 200ms instead of 50ms


If this works in the device monitor it should work on your ps4 too, as long you have the usb setting correct. Have you checked if it is still configured correctly on your PS4 ? A PS4 Software Update may have reset that setting.
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 76 guests