[Request] Snapback Removal

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

[Request] Snapback Removal

Postby Kanji » Sun Apr 10, 2022 2:41 pm

Basically if i flick my controlstick in one direction I don't want it to send inputs of the other direction when snapping back into its original position.

I found this thread about the same issue: viewtopic.php?f=26&t=15879&p=101843&hilit=snap+back#p101843

so my code looks like this at the moment:
Code: Select all
main {
 
    //snapback deny
 
    {
    if(get_actual(STICK_1_X) >= 100.0) 
    {if(time_active(STICK_1_X) < 100 && get_actual(STICK_1_X) < 0.0)
        {set_val(STICK_1_X,  0.0);}
    }}
    {
    if(get_actual(STICK_1_Y) >= 100.0) 
    {if(time_active(STICK_1_Y) < 100 && get_actual(STICK_1_Y) < 0.0)
        {set_val(STICK_1_Y,  0.0);}
    }}
    }


but yeah snapback is still there :c
User avatar
Kanji
Corporal
Corporal
 
Posts: 5
Joined: Mon Jul 26, 2021 1:02 pm

Re: [Request] Snapback Removal

Postby Kanji » Wed Apr 13, 2022 11:08 am

So I found a code that basically should fix snapback + another issue for use with an arduino.

as I read through scripts and stuff I try to learn as much as I can for myself but most things (especially adapting a c++ into a gpc script) are still way to advanced for me.

Heres part of the C++ (arduino) code I found online: (since I its part of a bigger collection of mods I removed the parts I thought weren't relevant but if they were I can post the full code later on.

Code: Select all
 
bool shield, tilt, dolphin = 0, off = 0;
byte axm, aym, cxm, cym, cycles;
char ax, ay, cx, cy, buf;
float swang, seang;
word mode, toggle;
unsigned long n;
 
void convertinputs(){
 
  backdash();      //fixes dashback by imposing a 1 frame buffer upon tilt turn values
} //more mods to come!
 
 
 
void backdash(){
  if(aym<23){
    if(axm<23)buf = cycles;
    if(buf>0){buf--; if(axm<64) gcc.xAxis = 128+ax*(axm<23);}
  }else buf = 0;
}
 
 
void loop(){
  controller.read();
  gcc = controller.getReport();
  ax = gcc.xAxis -128; ay = gcc.yAxis -128; //offsets from nuetral position of analog stick
  cx = gcc.cxAxis-128; cy = gcc.cyAxis-128; //offsets from nuetral position of c stick
  axm = abs(ax); aym = abs(ay);             //magnitude of analog stick offsets
  cxm = abs(cx); cym = abs(cy);             //magnitude of c stick offsets
  if(!off) convertinputs();                 //implements all the fixes (remove this line to unmod the controller)
  console.write(gcc);                       //sends controller data to the console
User avatar
Kanji
Corporal
Corporal
 
Posts: 5
Joined: Mon Jul 26, 2021 1:02 pm

Re: [Request] Snapback Removal

Postby Kanji » Tue Apr 19, 2022 8:02 am

I'm still looking for a decent anti snapback code.
Not sure if it is allowed to bump up my post for visibillity but since it's been a whole week I fugured it's probably okay if it isn't just let me know.
User avatar
Kanji
Corporal
Corporal
 
Posts: 5
Joined: Mon Jul 26, 2021 1:02 pm

Re: [Request] Snapback Removal

Postby Kanji » Tue May 03, 2022 5:27 pm

Still looking for a good anti snapback code :c
User avatar
Kanji
Corporal
Corporal
 
Posts: 5
Joined: Mon Jul 26, 2021 1:02 pm


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 126 guests