Stop Combo rather than wait for finish

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

Stop Combo rather than wait for finish

Postby cifer42 » Wed Nov 17, 2021 6:15 pm

Completely new to scripting but testing through the examples.

I have quite a long combo setup that start at a button press, loops and then stops looping on another press. All is working fine but I would like the combo to stop completely rather than wait until its finished with the button press.

Code: Select all
main {
  if (event_active(BUTTON_16) ) bLoop = !bLoop; // invert the current state with each press TRUE<->FALSE
 
  if (bLoop) combo_run(rotation); // keep the combo playback active as long as bLoop == TRUE
}
 
 
combo rotation {
my combo about 25 different buttons in order
 
}


If I press button 16 the combo finishes and then does not loop again, can I press button 16 and stop the combo midway ?

thanks in advance
User avatar
cifer42
Private First Class
Private First Class
 
Posts: 2
Joined: Wed Nov 17, 2021 6:11 pm

Re: Stop Combo rather than wait for finish

Postby Helic » Thu Dec 09, 2021 5:43 pm

Maybe if you split up the combo and have a bunch of boolean guards? Someone might be able to think of a more simple way, but that's how I'd do it. While (button) and then chain the boolean guards, and while not button reset all guards.
User avatar
Helic
Private First Class
Private First Class
 
Posts: 2
Joined: Thu Dec 09, 2021 5:15 pm

Re: Stop Combo rather than wait for finish

Postby cifer42 » Sun Dec 12, 2021 9:12 am

I found another snippet to stop the combo.
Code: Select all
if (event_active(BUTTON_13) )
            combo_stop(start);


So the complete

Code: Select all
 main {
  if (event_active(BUTTON_13) ) bLoop = !bLoop; // invert the current state with each press TRUE<->FALSE
 
  if (bLoop) combo_run(start); // keep the combo playback active as long as bLoop == TRUE
 
 if (event_active(BUTTON_13) )
            combo_stop(start);
 };


Pressing the button again stops the combo.
User avatar
cifer42
Private First Class
Private First Class
 
Posts: 2
Joined: Wed Nov 17, 2021 6:11 pm


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 154 guests