Programming Question (Vibration)

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

Programming Question (Vibration)

Postby riribibi » Wed Nov 27, 2019 5:17 am

Hey guys,

just wondering if it's possible to run a script where T2 lets go of a button the second my joystick vibrates? For example, I hold down the A button and the second it vibrates, the script would release the button? or anything that would be close/similar to this?

thanks in advance
User avatar
riribibi
Command Sergeant Major
Command Sergeant Major
 
Posts: 134
Joined: Fri Oct 31, 2014 12:33 pm

Re: Programming Question (Vibration)

Postby DontAtMe » Wed Nov 27, 2019 5:46 am

Code: Select all
 bool release_button;
 main{
   if(is_active(BUTTON_16)) {
    if(ffb_get_actual(FFB_1, 0) || ffb_get_actual(FFB_2, 0) || ffb_get_actual(FFB_3, 0) || ffb_get_actual(FFB_4, 0)) {
      release_button = TRUE;
    }
    if(release_button){
     set_val(BUTTON_16, 0);
   }
  } else release_button = FALSE;
 }
User avatar
DontAtMe
Captain
Captain
 
Posts: 502
Joined: Tue Oct 02, 2018 4:49 am

Re: Programming Question (Vibration)

Postby riribibi » Tue Dec 03, 2019 3:41 am

thank you for the response. just tried this out and it works but a little later than i had anticipated.

was wondering if there is any way to speed up the reaction time? (like instantaneously letting go of the button upon any hint of vibration) appreciate the help in advance
User avatar
riribibi
Command Sergeant Major
Command Sergeant Major
 
Posts: 134
Joined: Fri Oct 31, 2014 12:33 pm

Re: Programming Question (Vibration)

Postby DontAtMe » Tue Dec 03, 2019 5:48 am

riribibi wrote:was wondering if there is any way to speed up the reaction time? (like instantaneously letting go of the button upon any hint of vibration)


The script is doing exactly this already.

As soon as the FFB motors are assigned a value The A button gets set to 0. released

Not sure why its delayed for you. There must be another factor at play.
User avatar
DontAtMe
Captain
Captain
 
Posts: 502
Joined: Tue Oct 02, 2018 4:49 am


Return to GPC2 Script Programming

Who is online

Users browsing this forum: EvilGlenn and 193 guests