int prob

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

Re: int prob

Postby pablosscripts » Mon Sep 26, 2016 9:05 am

Ok my code above compiled fine, but it just doesn't work. My stick doesn't move at all! It's like it's frozen completely. When I comment it out, I can move my stick again. Has anyone actually been able to get this working?
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: int prob

Postby pablosscripts » Mon Sep 26, 2016 9:38 am

I tried this alternative one, and the stick is no longer frozen but it goes a little crazy. Right is left, left is left, down is up!

I've updated to the latest beta firmware btw:

Code: Select all
void sensitivity(uint8 IO_IDENT, fix32 midpoint, fix32 sens)
{
   
   value = get_val(IO_IDENT);
   if (value < 0.0)
   {
      value = abs(value);
      signed = TRUE;
   }
   
   if (midpoint)
      if (value > midpoint)
      {
         mid = value - midpoint;
         rest = 100.0 - midpoint;
         value = (50.0 / rest) * mid + 50.0;
      } else
         value = (50.0 / midpoint) * value;
   
   if (sens)
      value = (sens / 100.0) * value;
   
   if (value > 100.0)
      value = 100.0;
   
   if (signed)
      value = -value; // no inv()
     
   set_val(IO_IDENT, value);
}
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: int prob

Postby J2Kbr » Mon Sep 26, 2016 4:38 pm

Alright. sorry for the late contribution on the 'sensitivity' function, here is it implemented as it is on titan One:

Code: Select all
#include <ps4.gph>

main {
    sensitivity(PS4_RX, 25.0, 120.0);
}

void sensitivity(uint8 i, fix32 m, fix32 s) {
    fix32 v = get_val(i);
    if(v) {
        if(m) {
            v = (v > 0.0) ? midpoint(v, m) : midpoint(v * -1.0, m) * -1.0;
        }
        if(s) {
            v = (v * s) / 100.0;
        }
        if(v > 100.0) v = 100.0;
        else if(v < -100.0) v = -100.0;
        set_val(i, v);
    }
    return;
}

fix32 midpoint(fix32 v, fix32 m) {
    if(v <= m) return((v * 50.0) / m);
    return(((50.0 * (v - m)) / (100.0 - m)) + 50.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: int prob

Postby yohimbe » Mon Sep 26, 2016 5:01 pm

and how will this work in my example

Code: Select all
sensitivity( PS4_RX, MIDPOINT+variable, ADS_SENS+variable);
User avatar
yohimbe
Sergeant Major
Sergeant Major
 
Posts: 84
Joined: Sun Mar 01, 2015 7:27 pm

Re: int prob

Postby J2Kbr » Mon Sep 26, 2016 5:09 pm

please let me know the declaration of

MIDPOINT
ADS_SENS
variable
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: int prob

Postby UK_Wildcats » Mon Sep 26, 2016 5:13 pm

yohimbe wrote:and how will this work in my example

Code: Select all
sensitivity( PS4_RX, MIDPOINT+variable, ADS_SENS+variable);


Did you check out the other posts? We posted scriprs that will compile
User avatar
UK_Wildcats
Brigadier General
Brigadier General
 
Posts: 2243
Joined: Thu Jan 08, 2015 6:53 pm

Re: int prob

Postby pablosscripts » Mon Sep 26, 2016 5:14 pm

UK_Wildcats_Fans wrote:
yohimbe wrote:and how will this work in my example

Code: Select all
sensitivity( PS4_RX, MIDPOINT+variable, ADS_SENS+variable);


Did you check out the other posts? We posted scriprs that will compile



All those scripts compiled but as I mentioned the two I tested didn't work at all. J2Kbr's original function was perfect though!
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: int prob

Postby yohimbe » Mon Sep 26, 2016 5:15 pm

yeah they compiled but didnt work

so pls

Code: Select all
 
define ADS_SENS = 100;
    define OVE_SENS = 100
    define MIDPOINT = 50;

int add_time; 
int add_times;
int add_timem;

main {   


       
    }
      if (get_val(ADS) ) {       
            sensitivity( 9, MIDPOINT+add_timem, ADS_SENS+add_time);       
            sensitivity(10, MIDPOINT+add_timem, ADS_SENS+add_time);
        }else{
        // OVERALL SENS
            sensitivity( 9, MIDPOINT+add_timem, OVE_SENS+add_times);
            sensitivity(10, MIDPOINT+add_timem, OVE_SENS+add_times);
        }

    if(get_val(XB1_LT)){
    if(event_press(XB1_Y)){add_times = add_times + 5;}
   
    if(event_press(XB1_B)){
                    add_times = add_times - 5;
                }  }
    if(get_val(XB1_LS)){
    if(event_press(XB1_Y)){add_timem = add_timem + 5;}
   
    if(event_press(XB1_B)){
                    add_timem = add_timem - 5;
                }  }
                 
    if(get_val(XB1_P4)){
    if(event_press(XB1_Y)){add_time = add_time + 5;}
   
    if(event_press(XB1_B)){
                    add_time = add_time - 5;
                }

User avatar
yohimbe
Sergeant Major
Sergeant Major
 
Posts: 84
Joined: Sun Mar 01, 2015 7:27 pm

Re: int prob

Postby J2Kbr » Mon Sep 26, 2016 5:24 pm

call like this:

sensitivity( 9, (fix32)(MIDPOINT+add_timem), (fix32)(ADS_SENS+add_time));
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: int prob

Postby yohimbe » Mon Sep 26, 2016 5:42 pm

i got

Code: Select all
int ADS_SENS = 100;
int OVE_SENS = 100;
int MIDPOINT = 50;

sensitivity( 9, (fix32)(MIDPOINT+add_timem), (fix32)(ADS_SENS+add_times));   
 sensitivity( 10, (fix32)(MIDPOINT+add_timem), (fix32)(ADS_SENS+add_times)); 
        }
   else{
        // OVERALL SENS
sensitivity( 9, (fix32)(MIDPOINT+add_timem), (fix32)(ADS_SENS+add_time));   
  sensitivity( 10, (fix32)(MIDPOINT+add_timem), (fix32)(ADS_SENS+add_times));   
        } 
if(get_val(BUTTON_8)){
      if(event_active(BUTTON_14)){add_times = add_times + 5;}
       if(event_active(BUTTON_15)){add_times = add_times - 5;}
   }
    if(get_val(BUTTON_9)){
      if(event_active(BUTTON_14)){add_timem = add_timem + 5;}
      if(event_active(BUTTON_15)){add_timem = add_timem - 5;}
   }
                 
    if(get_val(BUTTON_21)){
      if(event_active(BUTTON_14)){add_time = add_time + 5;}
      if(event_active(BUTTON_15)){add_time = add_time - 5;}
   }
 if(get_val(BUTTON_6)) {combo_run(uu);  set_val(BUTTON_6, 0.0);}
if(get_val(BUTTON_20)){combo_run(a);  set_val(BUTTON_20, 0.0);}


}


with no effect
even with
Code: Select all
define ADS_SENS = 200;
    define OVE_SENS = 200;
    define MIDPOINT = 10;

no difference
User avatar
yohimbe
Sergeant Major
Sergeant Major
 
Posts: 84
Joined: Sun Mar 01, 2015 7:27 pm

PreviousNext

Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 82 guests