Converting a device script for Titan one

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

Converting a device script for Titan one

Postby Flyers1987 » Thu Oct 03, 2019 3:49 pm

I have a script for the golf club 2019 that I use on device however my friend who uses a Titan one try to use it when I emailed it to him and it's coming up with one error is there something I have to add to get a device script to work on Titan one?
User avatar
Flyers1987
Sergeant Major
Sergeant Major
 
Posts: 74
Joined: Mon Apr 29, 2019 7:22 pm

Re: Converting a device script for Titan one

Postby DontAtMe » Thu Oct 03, 2019 3:52 pm

Flyers1987 wrote:I have a script for the golf club 2019 that I use on device however my friend who uses a Titan one try to use it when I emailed it to him and it's coming up with one error is there something I have to add to get a device script to work on Titan one?

Post the script here,
User avatar
DontAtMe
Captain
Captain
 
Posts: 502
Joined: Tue Oct 02, 2018 4:49 am

Re: Converting a device script for Titan one

Postby Flyers1987 » Thu Oct 03, 2019 4:24 pm

How do I post the script here other than copy and pasting which I know you boys don't like
User avatar
Flyers1987
Sergeant Major
Sergeant Major
 
Posts: 74
Joined: Mon Apr 29, 2019 7:22 pm

Re: Converting a device script for Titan one

Postby DontAtMe » Thu Oct 03, 2019 4:30 pm

you can paste the script, there is nothing against this.
User avatar
DontAtMe
Captain
Captain
 
Posts: 502
Joined: Tue Oct 02, 2018 4:49 am

Re: Converting a device script for Titan one

Postby Flyers1987 » Thu Oct 03, 2019 4:32 pm

Here it is. He gets an error on line 52 however it works fine on my device
Code: Select all
/* The Golf Club 2019
 
 
v1.2
    Added X_VARIANCE.  Maximum amount X axis will vary (+-)
 
 
 
v1.1
    Chip - LT/L2 + A/Cross
    Swing Strenth - Hold A/Cross then Up/Down (+- 5 each tap) TRACE_4 shows max backswing value
------------------------------------------------------------------------------------------
v1.0
    ***IF YOU USE LEFT STICK TO SWING SET SWING_STICK = LEFT;***
 
    To use Random Delay Times at Top of The Swing set RANDOM_DELAY_TOP = TRUE
 
    Full Swing - HOLD LT/L2 then tap RT/R2
 
    Smooth Follow Through on Putt - Pull swing stick back untill putter head is at desired location then tap
                                    either LT/L2 or RT/R2
                                                                     */

    define RIGHT = 10;
    define LEFT  = 12;
 
 
    //--Change to LEFT for Left Stick Swing
    define SWING_STICK = RIGHT;
 
    //--Change to FALSE to Use a Random Delay Time
    define RANDOM_DELAY_TOP = TRUE;
 
    //--Maximum Amount X will Vary (+-) During Swing
    define X_VARIANCE       = 15;   
 
    define BACK_SWING_LOWER = 10;
    define BACK_SWING_UPPER = 20;
 
    define DOWN_SWING_LOWER = 30;
    define DOWN_SWING_UPPER = 40;
 
    define DELAY_TOP_LOWER = 700;
    define DELAY_TOP_UPPER = 800;
 
//--------------------------------------------------
    const byte SP[][] = {
    {100,95,90,85,80,75},
    {0,12,14,16,18,20}};
 
 
    int rnd_back,back_val;
    int rnd_down,down_val;
    int rnd_delay,delay;
    int rnd_x,rx_val,rx_count;
    int ry_val,back_max_val;
    int swing,set,swing_y,swing_x,back,down;
    int putt,putt_val,idx;
 
    int b,bb,bb_array[3];
 
init {
    swing_y = SWING_STICK;
    swing_x = SWING_STICK - 1;
    back_max_val = 100;
}
 
 
main {
 
    set_val(30,back_val);
    set_val(31,down_val);
    set_val(32,delay / 10);
    set_val(33,back_max_val);
    set_val(34,rx_val);
 
    //--swing strength
    if(get_val(XB1_A) && event_press(XB1_DOWN))
        back_max_val -= 5;
    if(get_val(XB1_A) && event_press(XB1_UP)) {
        back_max_val += 5;
        if(back_max_val > 100)back_max_val = 100;
    }
 
    //--swing
    if(get_val(XB1_LT) && event_press(XB1_RT)) {
        swing = TRUE;
        set = FALSE;
        if(!RANDOM_DELAY_TOP) delay = 750;
    }
    //--chip
    if(get_val(XB1_LT) && event_press(XB1_A)) {
        swing = TRUE;
        set = FALSE;
        delay = 900;
    }
    //--putt smooth follow through
    if(get_val(swing_y) > 20 && event_press(XB1_LT)) {
        putt = TRUE;
        ry_val = get_val(swing_y);
        if(ry_val < 30) putt_val = 5;
        if(ry_val > 30 && ry_val < 70) putt_val = 10;
        if(ry_val > 70) putt_val = 20;
    }
 
//--------------------------------------------------------------
//--Swing
    if(swing) {
        if(!set) {
            combo_run(SET);
        }else{
            if(back) {
                ry_val += back_val;
                if(ry_val > back_max_val) {
                    ry_val = back_max_val;
                    back = FALSE;
                    combo_run(DELAY_TOP);
                }
            }
            if(down) {
                ry_val -= down_val;
                if(ry_val < -100) {
                    ry_val = -100;
                    down = FALSE;
                    swing = FALSE;
                    back_max_val = 100;
                }
            }
            rx_count += 1;
            if(rx_count == 5) {
                //--new RX every 50 ms
                rx_val = rnd_x;
                rx_count = 0;
            }
            set_val(swing_y,ry_val);
            set_val(swing_x,rx_val);
        }
    }
 
//--------------------------------------------------------------
//--PUTT
    if(putt) {
        ry_val -= putt_val;
        if(ry_val <= -100) {
            ry_val = -100;
            putt = FALSE;
        }
        set_val(swing_y,ry_val);
    }
 
 
//--------------------------------------------------------------
//--SCROLL VALS
    rnd_back += 1;
    rnd_down += 1;
    rnd_x += 1;
    rnd_delay += 10;
 
    if(rnd_back  > BACK_SWING_UPPER) rnd_back  = BACK_SWING_LOWER;
    if(rnd_down  > DOWN_SWING_UPPER) rnd_down  = DOWN_SWING_LOWER;
    if(rnd_x > X_VARIANCE)           rnd_x     = inv(X_VARIANCE);   
    if(rnd_delay > DELAY_TOP_UPPER)  rnd_delay = DELAY_TOP_LOWER;
}
combo SET {
    wait(1000);
    rx_val = rnd_x;
    back_val = rnd_back;
    down_val = rnd_down;
    if(RANDOM_DELAY_TOP) delay = rnd_delay;
    set = TRUE;
    back = TRUE;
}
combo DELAY_TOP {
    wait(delay);
    down = TRUE;
}
User avatar
Flyers1987
Sergeant Major
Sergeant Major
 
Posts: 74
Joined: Mon Apr 29, 2019 7:22 pm

Re: Converting a device script for Titan one

Postby DontAtMe » Thu Oct 03, 2019 4:49 pm

Code: Select all
 
/* The Golf Club 2019
 
 
v1.2
Added X_VARIANCE. Maximum amount X axis will vary (+-)
 
 
 
v1.1
Chip - LT/L2 + A/Cross
Swing Strenth - Hold A/Cross then Up/Down (+- 5 each tap) TRACE_4 shows max backswing value
------------------------------------------------------------------------------------------
v1.0
***IF YOU USE LEFT STICK TO SWING SET SWING_STICK = LEFT;***
 
To use Random Delay Times at Top of The Swing set RANDOM_DELAY_TOP = TRUE
 
Full Swing - HOLD LT/L2 then tap RT/R2
 
Smooth Follow Through on Putt - Pull swing stick back untill putter head is at desired location then tap
either LT/L2 or RT/R2
**/
//--Change to LEFT for Left Stick Swing
//--Change to FALSE to Use a Random Delay Time
//--Maximum Amount X will Vary (+-) During Swing
//--------------------------------------------------
//--swing strength
//--swing
//--chip
//--putt smooth follow through
//--------------------------------------------------------------
//--Swing
//--new RX every 50 ms
//--------------------------------------------------------------
//--PUTT
//--------------------------------------------------------------
//--SCROLL VALS
 
 
define RIGHT = 10;
define LEFT = 12;
define SWING_STICK = RIGHT;
define RANDOM_DELAY_TOP = TRUE;
define X_VARIANCE = 15;
define BACK_SWING_LOWER = 10;
define BACK_SWING_UPPER = 20;
define DOWN_SWING_LOWER = 30;
define DOWN_SWING_UPPER = 40;
define DELAY_TOP_LOWER = 700;
define DELAY_TOP_UPPER = 800;
 
int SP[12];
 
int rnd_back, back_val;
int rnd_down, down_val;
int rnd_delay, delay;
int rnd_x, rx_val, rx_count;
int ry_val, back_max_val;
int swing, set, swing_y, swing_x, back, down;
int putt, putt_val, idx;
int b;
int bb;
int bb_array[3];
init{
  SP[0] = 100;
  SP[1]95;
  SP[2]90;
  SP[3] =   85;
  SP[4] =   80;
  SP[5] =   75;
  SP[6] = 0;
  SP[7]12;
  SP[8] =   14;
  SP[9] =   16;
  SP[10] =   18;
  SP[11]20;
  swing_y = SWING_STICK;
  swing_x = SWING_STICK - 1;
  back_max_val = 100;
}
 
 
main {
  set_val(30, back_val);
  set_val(31, down_val);
  set_val(32, delay / 10);
  set_val(33, back_max_val);
  set_val(34, rx_val);
  if (get_val(XB1_A) && event_press(XB1_DOWN)) back_max_val = back_max_val - 5;
  if (get_val(XB1_A) && event_press(XB1_UP)) {
    back_max_val =  back_max_val+5;
    if (back_max_val > 100) back_max_val = 100;
  }
  if (get_val(XB1_LT) && event_press(XB1_RT)) {
    swing = TRUE;
    set = FALSE;
    if (!RANDOM_DELAY_TOP) delay = 750;
  }
  if (get_val(XB1_LT) && event_press(XB1_A)) {
    swing = TRUE;
    set = FALSE;
    delay = 900;
  }
  if (get_val(swing_y) > 20 && event_press(XB1_LT)) {
    putt = TRUE;
    ry_val = get_val(swing_y);
    if (ry_val < 30) putt_val = 5;
    if (ry_val > 30 && ry_val < 70) putt_val = 10;
    if (ry_val > 70) putt_val = 20;
  }
  if (swing) {
    if (!set) {
      combo_run(c_SET);
    }
    else {
      if (back) {
        ry_val = ry_val +back_val;
        if (ry_val > back_max_val) {
          ry_val = back_max_val;
          back = FALSE;
          combo_run(c_DELAY_TOP);
        }
      }
      if (down) {
        ry_val =ry_val- down_val;
        if (ry_val <- 100) {
          ry_val = -100;
          down = FALSE;
          swing = FALSE;
          back_max_val = 100;
        }
      }
      rx_count = rx_count+ 1;
      if (rx_count == 5) {
        rx_val = rnd_x;
        rx_count = 0;
      }
      set_val(swing_y, ry_val);
      set_val(swing_x, rx_val);
    }
  }
  if (putt) {
    ry_val = ry_val-putt_val;
    if (ry_val <= - 100) {
      ry_val =- 100;
      putt = FALSE;
    }
    set_val(swing_y, ry_val);
  }
  rnd_back =rnd_back +1;
  rnd_down =rnd_down+1;
  rnd_x = rnd_x+1;
  rnd_delay =rnd_delay +10;
  if (rnd_back > BACK_SWING_UPPER) rnd_back = BACK_SWING_LOWER;
  if (rnd_down > DOWN_SWING_UPPER) rnd_down = DOWN_SWING_LOWER;
  if (rnd_x > X_VARIANCE) rnd_x = inv(X_VARIANCE);
  if (rnd_delay > DELAY_TOP_UPPER) rnd_delay = DELAY_TOP_LOWER;
}
 
 
combo c_SET {
  wait(1000);
  rx_val = rnd_x;
  back_val = rnd_back;
  down_val = rnd_down;
  if (RANDOM_DELAY_TOP) delay = rnd_delay;
  set = TRUE;
  back = TRUE;
}
 
combo c_DELAY_TOP {
  wait(delay);
  down = TRUE;
}
 
User avatar
DontAtMe
Captain
Captain
 
Posts: 502
Joined: Tue Oct 02, 2018 4:49 am

Re: Converting a device script for Titan one

Postby Flyers1987 » Thu Oct 03, 2019 4:55 pm

This will work on Titan one. How did you put that script in a box like that I don't know how to do it
User avatar
Flyers1987
Sergeant Major
Sergeant Major
 
Posts: 74
Joined: Mon Apr 29, 2019 7:22 pm

Re: Converting a device script for Titan one

Postby DontAtMe » Thu Oct 03, 2019 5:00 pm

Yes,

and
Code: Select all
[code=gpc]
paste script
[/code]
User avatar
DontAtMe
Captain
Captain
 
Posts: 502
Joined: Tue Oct 02, 2018 4:49 am

Re: Converting a device script for Titan one

Postby Flyers1987 » Fri Oct 04, 2019 6:58 am

Thanks the script is working great for him
User avatar
Flyers1987
Sergeant Major
Sergeant Major
 
Posts: 74
Joined: Mon Apr 29, 2019 7:22 pm

Re: Converting a device script for Titan one

Postby Flyers1987 » Fri Oct 11, 2019 3:13 am

Thank you for all your help on the script it was great however I realized that the variation on the x-axis does not include decimal points is there any way to add to that script that's a variance includes up to three or four decimal points and its variation this would increase the variation odds into the thousands of different numbers instead of just several. Thank you in advance
User avatar
Flyers1987
Sergeant Major
Sergeant Major
 
Posts: 74
Joined: Mon Apr 29, 2019 7:22 pm


Return to GPC1 Script Programming

Who is online

Users browsing this forum: No registered users and 77 guests