Start and stop with same button??
4 posts
• Page 1 of 1
Start and stop with same button??
So, this is how far I've gotten.
How can I start and stop the script with the same button? (Start and stop with XBOX_DOWN)
Thanks.
- Code: Select all
main {
if (event_press(XB1_LEFT)) { // Press LEFT to begin combo
combo_run(combo1);
}
if (get_val(XB1_DOWN)) { // Press DOWN to stop combo
if(combo_running(combo1) && event_press(XB1_DOWN)){
combo_stop(combo1);
}
}
}
combo combo1 {
How can I start and stop the script with the same button? (Start and stop with XBOX_DOWN)
Thanks.
-
Ctuna2000 - Sergeant Major
- Posts: 84
- Joined: Tue Mar 09, 2021 10:09 pm
Re: Start and stop with same button??
Try this:
- Code: Select all
main {
if(event_press(XB1_LEFT)) { // Press LEFT to begin combo
if(combo_running(combo1)) combo_stop(combo1);
else combo_run(combo1);
}
}
combo combo1 {
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
- Mad
- Major General
- Posts: 4533
- Joined: Wed May 22, 2019 5:39 am
Re: Start and stop with same button??
Mad wrote:Try this:
- Code: Select all
main {
if(event_press(XB1_LEFT)) { // Press LEFT to begin combo
if(combo_running(combo1)) combo_stop(combo1);
else combo_run(combo1);
}
}
combo combo1 {
}
Hi, thanks! Looks great!
Also, I'm not sure if there's any need of a "stop". From what I can see this kind of script only does the script once, then stops?
My other combos ("mycombo"), repeat the script over and over.
Any ideas?
Thanks.
-
Ctuna2000 - Sergeant Major
- Posts: 84
- Joined: Tue Mar 09, 2021 10:09 pm
Re: Start and stop with same button??
You can do it like this so it runs in a loop until you press left again.
- Code: Select all
int toggle;
main {
if(event_press(XB1_LEFT)) { // Press LEFT to begin combo
toggle = !toggle;
}
if(toggle) combo_run(combo1);
else if(combo_running(combo1)) combo_stop(combo1);
}
combo combo1 {
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
- Mad
- Major General
- Posts: 4533
- Joined: Wed May 22, 2019 5:39 am
4 posts
• Page 1 of 1
Return to GPC1 Script Programming
Who is online
Users browsing this forum: No registered users and 94 guests