Trouble with writing my script

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

Trouble with writing my script

Postby Relinquished » Sat Jul 04, 2020 6:46 pm

Hey i have been trying to make a script where if i hold the left analog stick down it rapidly goes from normal to down very quickly and i have had no luck any help?
User avatar
Relinquished
Sergeant Major
Sergeant Major
 
Posts: 100
Joined: Thu May 21, 2015 4:19 pm

Re: Trouble with writing my script

Postby Scachi » Sat Jul 04, 2020 6:57 pm

Code: Select all
 
#define S2Y_STARTVAL 5.0
#define S2Y_WAIT 1
#define S2Y_ADD  1.0
 
fix32 s2y;
 
main {
    if (get_actual(STICK_2_Y) > S2Y_STARTVAL) {
        set_val(STICK_2_Y,s2y);
        combo_run(s1yDown);
    } else {
        s2y = 0.0;
    }
}
 
combo s1yDown {
    s2y+=S2Y_ADD;
    if (s2y > 100.0) s2y = 0.0;
    wait(0);
    wait(S2Y_WAIT);
}
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Trouble with writing my script

Postby DontAtMe » Sun Jul 05, 2020 12:34 am

Code: Select all
#define S2Y_STARTVAL 5.0
 
main {
  if (get_val(STICK_2_Y) > S2Y_STARTVAL) {
    set_val(STICK_2_Y, sq(cos((fix32)system_time()/100f)) * 100f);
  }
}

:smile0207:
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: No registered users and 152 guests