Force combo to complete before interruption/pause
10 posts
• Page 1 of 1
Force combo to complete before interruption/pause
So I have this Snaking script, the combo currently is set to be interrupted if L2 or R2 are held. Is there anything I can do to this script, so that if L2 or R2 are pressed while the combo is active, that those inputs won't be actually active/sent to the console, until the combo has completed? I'd like to do this to avoid accidentally interrupting the combo by pressing too early and then I shoot while prone behind the cover because I've pressed before I've had a chance to start standing
- Code: Select all
#include <keyboard.gph>
#define irand(a, b) (((int)(rand() * (fix32)(b+1 - a))) + a)
main {
if (key_status(KEY_R)) {
if(time_active(KEY_R) > 10) set_val(8, 0);
if(time_active(KEY_R) > 10) set_val(STICK_2_Y, 0);
if (!get_val(4) && !get_val(7)) combo_run(Snake);
}
}
combo Snake {
set_val(24, 100.0);
wait(irand(20, 40));
set_val(24, 100.0);
set_val(14, 100.0);
wait(irand(325, 375)); wait(irand(30, 50));
set_val(14, 0.0);
set_val(24, -100.0);
set_val(8, 100.0);
wait(irand(150, 250));
}
-
TheBruhhh - First Sergeant
- Posts: 65
- Joined: Sun Nov 24, 2019 1:28 pm
Re: Force combo to complete before interruption/pause
time_active only works for buttons, need to make your own timers for keys.
you can check if a combo is running with if(combo_name)
you can check if a combo is running with if(combo_name)
- Code: Select all
#include <keyboard.gph>
#define irand(a, b) (((int)(rand() * (fix32)(b+1 - a))) + a)
uint32 timer;
main {
if(key_status(KEY_R)) {
if(elapsed_time() && ++timer >= 10) {
set_val(8, 0);
set_val(24, 0);
}
if(Snake) {
set_val(4, 0);
set_val(7, 0);
}
combo_run(Snake);
} else {
timer = 0;
}
}
combo Snake {
set_val(24, 100.0);
wait(irand(20, 40));
set_val(24, 100.0);
set_val(14, 100.0);
wait(irand(325, 375)); wait(irand(30, 50));
set_val(14, 0.0);
set_val(24, -100.0);
set_val(8, 100.0);
wait(irand(150, 250));
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
- Mad
- Major General
- Posts: 4533
- Joined: Wed May 22, 2019 5:39 am
Re: Force combo to complete before interruption/pause
Mad wrote:time_active only works for buttons, need to make your own timers for keys.
you can check if a combo is running with if(combo_name)
- Code: Select all
#include <keyboard.gph>
#define irand(a, b) (((int)(rand() * (fix32)(b+1 - a))) + a)
uint32 timer;
main {
if(key_status(KEY_R)) {
if(elapsed_time() && ++timer >= 10) {
set_val(8, 0);
set_val(24, 0);
}
if(Snake) {
set_val(4, 0);
set_val(7, 0);
}
combo_run(Snake);
} else {
timer = 0;
}
}
combo Snake {
set_val(24, 100.0);
wait(irand(20, 40));
set_val(24, 100.0);
set_val(14, 100.0);
wait(irand(325, 375)); wait(irand(30, 50));
set_val(14, 0.0);
set_val(24, -100.0);
set_val(8, 100.0);
wait(irand(150, 250));
}
Ah okay, thanks for correcting that! I've used this script but now L2 and R2 aren't functioning at all while the script is running. I was looking for it to interrupt the script from looping as before, but not interrupt the script before the combo is complete, if that makes sense.
-
TheBruhhh - First Sergeant
- Posts: 65
- Joined: Sun Nov 24, 2019 1:28 pm
Re: Force combo to complete before interruption/pause
Any ideas folks
-
TheBruhhh - First Sergeant
- Posts: 65
- Joined: Sun Nov 24, 2019 1:28 pm
Re: Force combo to complete before interruption/pause
- Code: Select all
#include <keyboard.gph>
#define irand(a, b) (((int)(rand() * (fix32)(b+1 - a))) + a)
uint32 timer;
main {
if(key_status(KEY_R)) {
if(elapsed_time() && ++timer >= 10) {
set_val(8, 0);
set_val(24, 0);
}
if(is_release(4) && is_release(7)) {
combo_run(Snake);
} else {
if(Snake) {
set_val(4, 0);
set_val(7, 0);
}
}
} else {
timer = 0;
}
}
combo Snake {
set_val(24, 100.0);
wait(irand(20, 40));
set_val(24, 100.0);
set_val(14, 100.0);
wait(irand(325, 375)); wait(irand(30, 50));
set_val(14, 0.0);
set_val(24, -100.0);
set_val(8, 100.0);
wait(irand(150, 250));
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
- Mad
- Major General
- Posts: 4533
- Joined: Wed May 22, 2019 5:39 am
Re: Force combo to complete before interruption/pause
Thanks Mad, not been around all week, perfect, thanks very much
-
TheBruhhh - First Sergeant
- Posts: 65
- Joined: Sun Nov 24, 2019 1:28 pm
Re: Force combo to complete before interruption/pause
Mad wrote:
- Code: Select all
#include <keyboard.gph>
#define irand(a, b) (((int)(rand() * (fix32)(b+1 - a))) + a)
uint32 timer;
main {
if(key_status(KEY_R)) {
if(elapsed_time() && ++timer >= 10) {
set_val(8, 0);
set_val(24, 0);
}
if(is_release(4) && is_release(7)) {
combo_run(Snake);
} else {
if(Snake) {
set_val(4, 0);
set_val(7, 0);
}
}
} else {
timer = 0;
}
}
combo Snake {
set_val(24, 100.0);
wait(irand(20, 40));
set_val(24, 100.0);
set_val(14, 100.0);
wait(irand(325, 375)); wait(irand(30, 50));
set_val(14, 0.0);
set_val(24, -100.0);
set_val(8, 100.0);
wait(irand(150, 250));
}
How would I convert this for PS4.gph?? Which numbers represent the buttons? please help!
-
GPCNoob - Staff Sergeant
- Posts: 14
- Joined: Wed Nov 25, 2020 2:24 am
Re: Force combo to complete before interruption/pause
no need to adjust the button numbers.
hit F1 in gtuner to see the list of button names and their numbers and you will see that the same number applied to different consoles/controllers and should just work the same as long as the game has the same button layout on both.
hit F1 in gtuner to see the list of button names and their numbers and you will see that the same number applied to different consoles/controllers and should just work the same as long as the game has the same button layout on both.
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: Force combo to complete before interruption/pause
Scachi wrote:no need to adjust the button numbers.
hit F1 in gtuner to see the list of button names and their numbers and you will see that the same number applied to different consoles/controllers and should just work the same as long as the game has the same button layout on both.
Thank you for the reply! much appreciated. the F1 does nothing in my gtunerIV for some reason
-
GPCNoob - Staff Sergeant
- Posts: 14
- Joined: Wed Nov 25, 2020 2:24 am
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
10 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: Google [Bot] and 78 guests