Code help

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

Code help

Postby SouthernEagle » Sun Sep 22, 2019 1:22 pm

I'm a new owner of the T2 and I'm trying to learn how to program it. Here is what I am wanting to do:

When I press BUTTON_12 for 1500 milliseconds, I want BUTTON_5 activated and held in until I press BUTTON_16

Thanks,
SE
User avatar
SouthernEagle
Private First Class
Private First Class
 
Posts: 2
Joined: Sun Aug 11, 2019 8:36 pm

Re: Code help

Postby bonefisher » Sun Sep 22, 2019 2:14 pm

Code: Select all
 
bool toggle;
 
main
{
  if(get_actual(BUTTON_12) && time_active(BUTTON_12) > 1500)
    {
        toggle = 1;
    }
    else if(event_active(BUTTON_16))
    {
        toggle = 0;
    }
    if(toggle== 1)set_val(BUTTON_5, 100.0);
}
 
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5413
Joined: Thu Jan 29, 2015 10:49 am

Re: Code help

Postby SouthernEagle » Sun Sep 22, 2019 2:17 pm

Thanks!
User avatar
SouthernEagle
Private First Class
Private First Class
 
Posts: 2
Joined: Sun Aug 11, 2019 8:36 pm

Re: Code help

Postby bonefisher » Sun Sep 22, 2019 2:17 pm

:smile0517:
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5413
Joined: Thu Jan 29, 2015 10:49 am


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 104 guests