[SOLVED] Double tap hold button to activate combo

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

Re: Double tap hold button to activate combo

Postby DontAtMe » Wed May 08, 2019 5:42 pm

my turn :)
The combo will run If Button 16 is pressed within 200ms from the time button 16 was last released.
Code: Select all
main {
  if (event_active(BUTTON_16) && time_release(BUTTON_16) < 200)
    combo_restart(sprint);
  if(sprint) sprint = is_active(BUTTON_16);
}
combo sprint {
  set_val(BUTTON_16, 0);
  wait(100); wait(100);
  combo_restart(sprint);
  wait(0);
}

Here is another version that you may find useful.
Code: Select all
int cool_down;
main {
  if(check_active(BUTTON_16, 200)) cool_down = 200;
  if(cool_down) cool_down -= elapsed_time();
  else if (event_active(BUTTON_16) && time_release(BUTTON_16) < 200)
    combo_restart(sprint);
  if(sprint) sprint = is_active(BUTTON_16);
}
combo sprint {
  set_val(BUTTON_16, 0);
  wait(100); wait(100);
  combo_restart(sprint);
  wait(0);
}
This one will make it so Button 16 must but pressed twice within 200ms. for the combo to run.
User avatar
DontAtMe
Captain
Captain
 
Posts: 502
Joined: Tue Oct 02, 2018 4:49 am

Re: Double tap hold button to activate combo

Postby alanmcgregor » Thu May 09, 2019 10:30 pm

LuckyBastard wrote:I tried out your script and it is definitely more effective in getting the result I need, and the code looks alot cleaner. I can understand everything in it. The line in my code here;

printf("sprint, bEnabled is now: %d",bEnabled);

is something I copied out of the example code from the gtuner iv guide, and it doesn't make a lick of sense to me. It seems like it is just cluttering up the script. Thanks again for the script. Do you think, I could get a hold of your RDR2 scripts somewhere? I would love to take a look at them, and it would be very helpful for me me to learn more about coding.


I'm glad it worked for you. :)

I remove that script along with a couple more, because on the Apex Legends hype I couldn't support it and they got pretty outdated.

On Red Dead, like many other fans I got pretty disappointed by the online PvP, and the single player I don't mine playing it with a controller. The only script I had for it is a gallop horse that allows me to switch between two speeds: fast and steady (doesn't drain stamina yet is faster) and that's it. QoL to avoid no smash that button, because as you know the toggle Run in the game only works in the character, not when riding or driving wagons.
User avatar
alanmcgregor
Major
Major
 
Posts: 981
Joined: Tue Mar 27, 2018 8:38 am

Re: [SOLVED] Double tap hold button to activate combo

Postby Justin420time » Sun Oct 23, 2022 6:34 am

DontAtMe wrote:my turn :)
The combo will run If Button 16 is pressed within 200ms from the time button 16 was last released.
Code: Select all
main {
  if (event_active(BUTTON_16) && time_release(BUTTON_16) < 200)
    combo_restart(sprint);
  if(sprint) sprint = is_active(BUTTON_16);
}
combo sprint {
  set_val(BUTTON_16, 0);
  wait(100); wait(100);
  combo_restart(sprint);
  wait(0);
}

Here is another version that you may find useful.
Code: Select all
int cool_down;
main {
  if(check_active(BUTTON_16, 200)) cool_down = 200;
  if(cool_down) cool_down -= elapsed_time();
  else if (event_active(BUTTON_16) && time_release(BUTTON_16) < 200)
    combo_restart(sprint);
  if(sprint) sprint = is_active(BUTTON_16);
}
combo sprint {
  set_val(BUTTON_16, 0);
  wait(100); wait(100);
  combo_restart(sprint);
  wait(0);
}
This one will make it so Button 16 must but pressed twice within 200ms. for the combo to run.


Sorry to bother. This code is really good for what I am doing, but I am having a hard time making the combo stop in the middle, if I want to run another combo instead or just stop(kill switch) the current running combo(Real-Time).

I love the fact it does the full combo after pressing a key twice, but sometimes I would like to stop the combo in the middle(real-time) so that it doesn't finish the full combo and either goes onto another combo or just stops running the rest of the combo.

"If button pressed twice, run combo(perfect), but if another button is pressed(during running combo), combo stops(real-time) and another combo runs or current combo just stops(I want a kill switch or another combo to run)"

Hope that makes sense..

Any help is appreciated.. Thank you for taking the time to look at this post.

-Justin
paypal.me/xkjtx
UserBenchmarks:Game 96%,Desk 95%,Work 90%
CPU:AMD Ryzen 5 3600XT-87.5%
GPU:Nvidia RTX 3060-104.1%
RAM:Unknown 8G 135-K 4x8GB-94.7%
MBD:Gigabyte GA-B550 AORUS PRO AC
User avatar
Justin420time
First Sergeant
First Sergeant
 
Posts: 44
Joined: Fri Nov 02, 2018 6:48 pm

Re: [SOLVED] Double tap hold button to activate combo

Postby Mad » Sun Oct 23, 2022 7:32 am

You can stop a combo with combo_stop; https://www.consoletuner.com/wiki/index ... combo_stop
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
Mad
Major General
Major General
 
Posts: 4533
Joined: Wed May 22, 2019 5:39 am

Re: [SOLVED] Double tap hold button to activate combo

Postby Justin420time » Sun Oct 23, 2022 12:32 pm

Mad wrote:You can stop a combo with combo_stop; https://www.consoletuner.com/wiki/index ... combo_stop


Well, after I restarted Gtuner, it started working, but I tried "combo_stop" and it just didnt work at all..
Thats why I posted.. But next time this happends, I will restart Gtuner if not working correctly.. There
are a few glitches I have found when coding over and over again really fast. Compile and Install to memory
over a over without restarting, can have problem, I am finding out.

-Justin
paypal.me/xkjtx
UserBenchmarks:Game 96%,Desk 95%,Work 90%
CPU:AMD Ryzen 5 3600XT-87.5%
GPU:Nvidia RTX 3060-104.1%
RAM:Unknown 8G 135-K 4x8GB-94.7%
MBD:Gigabyte GA-B550 AORUS PRO AC
User avatar
Justin420time
First Sergeant
First Sergeant
 
Posts: 44
Joined: Fri Nov 02, 2018 6:48 pm

Previous

Return to GPC2 Script Programming

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 114 guests