*obsolete* Converting Titan1 scripts to Titan2 using T1.gph

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

*obsolete* Converting Titan1 scripts to Titan2 using T1.gph

Postby Scachi » Wed Feb 22, 2017 7:36 am

! This tutorial is no longer required !

Info:
Since Gtuner IV 1.00RC, there is full backward compatibility by just adding
Code: Select all
#include <titanone.gph> 

at the beginning of the Titan One script code.


Obsolete tutorial:

The T1 (Backward Compatibility) header file T1.gph from PaulaTheKoala is doing a great job in helping to get Titan One scripts working for the Titan Two. It only requires a few changes to the T1 script most of the time.

This is a small tutorial on how I use the header file trying to convert the script "black_ops_super_snake_glitch.gpc" to the Titan Two

Step One: Creating a new minimum GPC script file
  1. Start GTuner IV
  2. File->New->Minimum GPC Script
  3. Save this new file into a new directory, I name the directory according to the scripts name: "black_ops_super_snake_glitch". The filename: "black_ops_super_snake_glitch"
    1_create.png
    1_create.png (11.43 KiB) Viewed 4143 times
  4. The created file should now be opened in the "GPC Scrip IDE" pane
  5. Keep just the first line (#pragma....), delete everything else.
  6. Put in a description with a link/information to the original scripts author, he/she deserves it, the full file content for now:
    Code: Select all
     #pragma METAINFO("black_ops_super_snake_glitch", 1, 0, "Scachi")
     
    /*
    Black Ops Super Snake Glitch Script 1.0 by bonefisher
    http://www.consoletuner.com/gpclib/?s=1170
    converted to the Titan Two by Scachi
    */

     

Step Two: Getting the T1 (Backward Compatibility) header ready to work
  1. In GTuner IV click one the "Online Resource" pane and search for "compatibility" in the search mask
    2_t1gph.png
    2_t1gph.png (67.79 KiB) Viewed 4143 times
  2. Click "Download" on the T1 (Backward Compatibility) entry from PaulaTheKoala
  3. Close the T1.gph file in the "GPC Scrip IDE" pane
  4. A "_t1" directory should now exist in your workspace "File Explorer" panel
  5. Copy/Drag and drop the file T1.gph from the _t1 directory into the directory created in "Step One" : "black_ops_super_snake_glitch"

Step Three: The original T1 script file I want to convert
  1. Download the script from the GPC Library http://www.consoletuner.com/gpclib/?s=1170 and save it as black_ops_super_snake_glitch_org.gpc into the directory "black_ops_super_snake_glitch" (created in Step One)
  2. Open the file in GTuner IV

Step Four: The actual work
  1. To use the T1.gh file include it by adding this line :
    Code: Select all
    #include "T1.gph"

    I put all the #include lines (if more are required) directly below the #pragma line.
  2. Hit the Compile button, no error should occur in the "Output Panel": GPC success: GPC Compile succeeded with 0 warning(s).
  3. Fine, continuing...
  4. Copy all the content from the original script at the end of our work file
  5. Hit the "Compile" button
    3_done.png
    3_done.png (14.28 KiB) Viewed 4143 times
  6. Done ;-) Copy the script to a slot of your T2 and have fun with it.
  7. Here is the full script content of the version for the Titan2
    Code: Select all
    #pragma METAINFO("black_ops_super_snake_glitch", 1, 0, "username")
     
    /*
    Black Ops Super Snake Glitch Script 1.0 by bonefisher
    http://www.consoletuner.com/gpclib/?s=1170
    converted to the Titan Two by Scachi
    */

     
    #include "T1.gph"
     
    // GPC Online Library
    // black_ops_super_snake_glitch.gpc
     
     
     // ADS TRIGGER + D-PAD LEFT TURNS IT ON/OFF.
     // SNAKES IN ALL DIRECTIONS!
     
    define ADS          =  7;
    define D_PAD_LEFT   = 15;
    define JUMP         = 19;
    define CROUCH       = 18;
     
    int snake;
     
    init {
    snake = get_pvar(SPVAR_1, 1, 2, 2);
    }
     
    main {
     
        if (get_val(ADS) && event_press(D_PAD_LEFT)) {
            if (snake == 1) {
                snake = 2;
            } else if (snake == 2) {
                snake = 1;
            }
            set_pvar(SPVAR_1, snake);
     
            if (snake == 1) {
                combo_run(RumbleNotifier);
            }
        }
        if (snake == 1) { combo_run(Snaking); }
    }
     
    combo RumbleNotifier {
        set_rumble(RUMBLE_A, 100);
        wait(200);
        reset_rumble();
    }
     
    combo Snaking                {
        set_val     (CROUCH, 100);
        wait                (150);
        set_val     (CROUCH, 100);
        set_val       (JUMP, 100);
        wait                (100);
        set_val     (CROUCH, 100);
        set_val         (JUMP, 0);
        wait                (100);
        set_val     (CROUCH, 100);
        set_val       (JUMP, 100);
        wait                (100);
        set_val       (CROUCH, 0);
        set_val         (JUMP, 0);
        wait                (100);
    }
     


Some typical GPC errors "Output Panel" messages
The number in brackets (60) is the line number of the script where the error is found.
  1. Code: Select all
    GPC error: example.gpc(60): Identifier not declared 'PS4_SQUARE'.

    PS4 button names where used in this script, so add an include to your script:
    Code: Select all
    #include <ps4.gph>
  2. Code: Select all
    GPC error: example.gpc(60): Identifier not declared 'XB1_X'.

    Xbox button names where used in this script, so add an include to your script:
    Code: Select all
    #include <XB1.gph>
    Other possible button name includes: ps3.gph xb360.gph

  3. Code: Select all
    GPC error: example.gpc(133): Illegal operation 'arg:1'.

    This is probably a function being called with an argument, to make this work the function definition itself has to be edited.
    Basically every argument has to be prefixed with "int".
    Try to find the function definition in the code, the line you are looking for should start with "function" followed by the name of the function as it is called in line 133.
    Example:
    Code: Select all
    function ExampleFunc( a, b, c)
    should be edited to read
    Code: Select all
    function ExampleFunc(int a, int b, int c)
Last edited by Scachi on Wed Jul 05, 2017 6:30 am, edited 8 times in total.
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Converting Titan One scripts to Titan Two using T1.gph

Postby maikolo66 » Wed Feb 22, 2017 10:53 am

man Im trying but I cant even get the T1.gph to work. Im following step by step but still no luck.

GPC error: T1.gph(340): syntax error, unexpected POW, expecting IDENTIFIER or MUL_OP 'pow'.

and im compiling what you just did but its still giving me errors. Man Im doing something wrong I just cant see it. I appreciate your help. Im gonna sleep this off and comeback and try again till I figure out what im doing wrong. Thank you
User avatar
maikolo66
Staff Sergeant
Staff Sergeant
 
Posts: 11
Joined: Thu Feb 09, 2017 10:00 pm

Re: Converting Titan One scripts to Titan Two using T1.gph

Postby Scachi » Wed Feb 22, 2017 11:09 am

maikolo66 wrote:man Im trying but I cant even get the T1.gph to work. Im following step by step but still no luck.

GPC error: T1.gph(340): syntax error, unexpected POW, expecting IDENTIFIER or MUL_OP 'pow'.

and im compiling what you just did but its still giving me errors. Man Im doing something wrong I just cant see it. I appreciate your help. Im gonna sleep this off and comeback and try again till I figure out what im doing wrong. Thank you


That's not your fault. Looks like this is an issue with the latest Update of GTuner/Firmware.
To fix this for now open the T1.gph file and comment line 340 to 343 out, like this:

Code: Select all
 
/* uint16 pow(uint16 x, uint16 y)
{
    return x ^ y;
}  */

 
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Converting Titan One scripts to Titan Two using T1.gph

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

Great tutorial, sticked!! :)
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: Converting Titan One scripts to Titan Two using T1.gph

Postby maikolo66 » Wed Feb 22, 2017 7:11 pm

:smile0202: aaaahhh,yes that did it!!! thank you SCACHI and J2Kbr you guys are awesome :smile0203: went to sleep upset, but at least I can have a good start to my morning.

And ya, Tutorial is Awesome bro :joia:
User avatar
maikolo66
Staff Sergeant
Staff Sergeant
 
Posts: 11
Joined: Thu Feb 09, 2017 10:00 pm

Re: Converting Titan One scripts to Titan Two using T1.gph

Postby Scachi » Fri Feb 24, 2017 12:24 pm

Scachi wrote:
maikolo66 wrote:man Im trying but I cant even get the T1.gph to work. Im following step by step but still no luck.

GPC error: T1.gph(340): syntax error, unexpected POW, expecting IDENTIFIER or MUL_OP 'pow'.

and im compiling what you just did but its still giving me errors. Man Im doing something wrong I just cant see it. I appreciate your help. Im gonna sleep this off and comeback and try again till I figure out what im doing wrong. Thank you


That's not your fault. Looks like this is an issue with the latest Update of GTuner/Firmware.
To fix this for now open the T1.gph file and comment line 340 to 343 out, like this:

Code: Select all
 
/* uint16 pow(uint16 x, uint16 y)
{
    return x ^ y;
}  */

 

Just as a note: The above step is no longer need. PaulaTheKoala has updated the T1.gph file.
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Converting Titan One scripts to Titan Two using T1.gph

Postby J2Kbr » Fri Feb 24, 2017 1:56 pm

Scachi wrote:Just as a note: The above step is no longer need. PaulaTheKoala has updated the T1.gph file.

+1 -- I just saw the update today (thanks Paula) ... @ maikolo66: please download the new version of the t1.gph
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: Converting Titan One scripts to Titan Two using T1.gph

Postby pablosscripts » Sat Feb 25, 2017 8:02 am

Awesome tutorial I was hoping someone would create this!
Setup: XIM Apex, T2, K780 keyboard, G Pro Wireless mouse, SteelSeries 4HD pad, DXRacer armrest, LucidSound LS30 headset, Netduma router, Ubiquiti UniFi AP LR

My R6 script: https://youtu.be/x-9NtxyySVM
User avatar
pablosscripts
Brigadier General
Brigadier General
 
Posts: 1976
Joined: Tue Nov 24, 2015 6:27 am

Re: Converting Titan One scripts to Titan Two using T1.gph

Postby jeta10 » Tue Feb 28, 2017 8:42 am

Hi I just got my T2 today so I am new to all this.

With no scripting knowledge at all I've just used this guide and converted the Uncharted 4 T1 script to T2. It seems to work I guess as after compiling it says 0 errors found. I then saved the script to a memory slot.

My question is, when I saved the Titanfall 2 gamepack to a memory slot there's the customisation button in the memory slot which enables me to adjust the configuarion of the gamepack etc.

The memory slot which contains my converted Uncharted 4 file does not have this customisation button. Is this correct?
I don't have a T1 so never used this Uncharted 4 script before so have no idea if it's a customisable script or does it just works "as is"? Anyone know?

Do all scripts saved to a memory slot have a customisation button?
User avatar
jeta10
First Sergeant
First Sergeant
 
Posts: 64
Joined: Sun Feb 19, 2017 2:40 pm

Re: Converting Titan One scripts to Titan Two using T1.gph

Postby pablosscripts » Tue Feb 28, 2017 8:47 am

nbjjago wrote:Hi I just got my T2 today so I am new to all this.

With no scripting knowledge at all I've just used this guide and converted the Uncharted 4 T1 script to T2. It seems to work I guess as after compiling it says 0 errors found. I then saved the script to a memory slot.

My question is, when I saved the Titanfall 2 gamepack to a memory slot there's the customisation button in the memory slot which enables me to adjust the configuarion of the gamepack etc.

The memory slot which contains my converted Uncharted 4 file does not have this customisation button. Is this correct?
I don't have a T1 so never used this Uncharted 4 script before so have no idea if it's a customisable script or does it just works "as is"? Anyone know?

Do all scripts saved to a memory slot have a customisation button?


It's a new feature in T2, but they have to be specifically programmed for. Here's a guide I wrote:

viewtopic.php?f=26&t=5045
Setup: XIM Apex, T2, K780 keyboard, G Pro Wireless mouse, SteelSeries 4HD pad, DXRacer armrest, LucidSound LS30 headset, Netduma router, Ubiquiti UniFi AP LR

My R6 script: https://youtu.be/x-9NtxyySVM
User avatar
pablosscripts
Brigadier General
Brigadier General
 
Posts: 1976
Joined: Tue Nov 24, 2015 6:27 am

Next

Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 86 guests