fathead2k's Analog Sticks to "Digital" script but with get_val only

A demonstration using get_val only. -Token
Version1.10
Authortoken
Publish DateSun, 9 Mar 2014 - 23:34
Last UpdateTue, 11 Mar 2014 - 04:32
Downloads61
RATE


0

0

Release Notes: I added my explanation from the forums.
Code: Select all
 
 
define LX=PS3_LX// <-- Change ALL 4 to the controller of choice (i.e. XB360_LX or XB1_LX or PS4_LX etc)
define LY=PS3_LY;
define RX=PS3_RX;
define RY=PS3_RY;
 
 
main {
 
  //  Left Analog Stick
 
    if(get_val(LX) > 15)
      set_val(LX, 100);
        else if(get_val(LX)< 100)
        set_val(LX, 0);
    if(get_lval(LX) < -15)
      set_val(LX, -100);   
        else if(get_val(LX)<  -100)
        set_val(LX, 0);
 
    if(get_val(LY) > 15)
      set_val(LY, 100);   
        else if(get_val(LY)<100)
        set_val(LY, 0);
   if(get_lval(LY) < -15)
      set_val(LY, -100);       
        else if(get_val(LY)< -100)
        set_val(LY, 0);
 
 
  //  Right Analog Stick (*DO NOT USE THIS PART ON FPS OR ANY GAME THAT USES RIGHT ANALOG AS AIM)
 
    if(get_val(RX) > 15)
      set_val(RX, 100);
        else if(get_val(RX)< 100)
        set_val(RX, 0);
    if(get_lval(RX) < -15)
      set_val(RX, -100);
        else if(get_val(RX)<  -100)
        set_val(RX, 0);
 
    if(get_val(RY) > 15)
      set_val(RY, 100);
        else if(get_val(RY)< 100)
        set_val(RY, 0);
    if(get_lval(RY) < -15)
      set_val(RY, -100);
        else if(get_val(RY)< -100)
        set_val(RY, 0);
 
}
/*I will explain what is happening. I will start with the x axis.
 
If x axis is above 15 make x axis 100. If that's not true then whenever x axis is below 100 make x axis 0. Now with the negatives. If x axis is below -15 make x axis -100.
If that's not true then whenever x axis is below -100 make x axis 0. We have a contradictory statement and an impossible statement.
We can't have both "if x axis less than 100 make it 0 and if x axis less than -15 make it -100". Statement 1 cancels statement 2. The impossible statement " if value of x axis below -100 make it 0" is unattainable.
The x axis will never be below 0 under these conditions. The y axis too has the same predicament, it will never be below 0. The script will need get_lval to remedy the complication.
 
This is the same script but only using get_val.
define LX=PS3_LX;  // <-- Change ALL 4 to the controller of choice (i.e. XB360_LX or XB1_LX or PS4_LX etc)
define LY=PS3_LY;
define RX=PS3_RX;
define RY=PS3_RY;
 
 
 main {
 
  //  Left Analog Stick
 
    if(get_val(LX) > 15)      set_val(LX, 100); 
    else if(get_val(LX)> 0) set_val(LX, 0);
 
    if(get_val(LX) < -15)      set_val(LX, -100);     
   else if(get_val(LX) <  0) set_val(LX, 0);
 
    if(get_val(LY) > 15)      set_val(LY, 100); 
    else if(get_val(LY)> 0) set_val(LY, 0);
 
    if(get_val(LY) < -15)      set_val(LY, -100);     
   else if(get_val(LY) <  0) set_val(LY, 0);
 
 
  //  Right Analog Stick (*DO NOT USE THIS PART ON FPS OR ANY GAME THAT USES RIGHT ANALOG AS AIM)
 
    if(get_val(RX) > 15)      set_val(RX, 100); 
    else if(get_val(RX)> 0) set_val(RX, 0);
 
    if(get_val(RX) < -15)      set_val(RX, -100);     
   else if(get_val(RX) <  0) set_val(RX, 0);
 
    if(get_val(RY) > 15)      set_val(RY, 100); 
    else if(get_val(RY)> 0) set_val(RY, 0);
 
    if(get_val(RY) < -15)      set_val(RY, -100);     
   else if(get_val(RY) <  0) set_val(RY, 0);
 
 
}  */