stuck on a condition
6 posts
• Page 1 of 1
stuck on a condition
Hey Im stuck on double tap hold condition, but the same button is to macro rapid so something like this: but not working
I'M looking for x button to do this: if normally pressed to have normal function, but if i double tap and hold x to run combo RAPIDx, and to keep running it as long as Im holding x button. Is there any chance to write this code in with out switched or switches is a must.
EDIT: So I did some digging and I found this
any chance to make it work with out a switch, just wondering
- Code: Select all
#pragma METAINFO("MW ALEN", 1, 0, "<co-op>")
#define X_BUTTON BUTTON_17
main {
//RAPID X
if(get_val(X_BUTTON) && time_release(X_BUTTON) < 300 && time_active(X_BUTTON) > 500) {
combo_run(RAPIDx);
}
}
combo RAPIDx {
set_val(X_BUTTON, 100.0);
wait(40);
set_val(X_BUTTON, 0.0);
wait(40);
}
I'M looking for x button to do this: if normally pressed to have normal function, but if i double tap and hold x to run combo RAPIDx, and to keep running it as long as Im holding x button. Is there any chance to write this code in with out switched or switches is a must.
EDIT: So I did some digging and I found this
- Code: Select all
bool toggle;
main {
if(event_active(BUTTON_16) && time_release(BUTTON_16) <= 200) {
toggle = 1;
}else if(event_release(BUTTON_16)) {
toggle = 0;
}
if(toggle == 1) {
combo_run(TEST);
}
}
combo TEST
{
set_val(BUTTON_16, 100.0);
wait(40);
set_val(BUTTON_16, 0.0);
wait(40);
}
any chance to make it work with out a switch, just wondering
-
alencroat - Lieutenant
- Posts: 320
- Joined: Sun Oct 15, 2017 5:58 pm
Re: stuck on a condition
The last one is already only active as long as you hold down that button after the double tap.
As soon as you release that button the combo will not be started anymore.
Not sure what you are asking for.
As soon as you release that button the combo will not be started anymore.
Not sure what you are asking for.
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: stuck on a condition
- Code: Select all
bool toggle;
main {
if(event_active(BUTTON_17) && time_release(BUTTON_17) <= 200) {
toggle = 1;
}else if(event_release(BUTTON_17)) {
toggle = 0;
}
if(toggle == 1) {
combo_run(RAPIDx);
}
}
combo RAPIDx {
set_val(BUTTON_17, 100.0);
wait(40);
set_val(BUTTON_17, 0.0);
wait(40);
}
No way around it unless you wanted just run once the combo!
Now I don't see why I couldn't do it I built one that should of but only ran once when it should of loop until I release !
- bonefisher
- Lieutenant General
- Posts: 5413
- Joined: Thu Jan 29, 2015 10:49 am
Re: stuck on a condition
Without having to use a toggle var:
- Code: Select all
main {
rapid_cross = (rapid_cross || ((event_active(BUTTON_16) && time_release(BUTTON_16) <= 200))) * is_active(BUTTON_16);
}
combo rapid_cross {
set_val(BUTTON_16, 100.0);
wait(40);
set_val(BUTTON_16, 0.0);
wait(40);
combo_restart(rapid_cross);
wait(0);
}
-
Buffy - Lieutenant
- Posts: 422
- Joined: Wed Jul 20, 2016 5:23 am
Re: stuck on a condition
Without having to use a comboBuffy wrote:Without having to use a toggle var:
- Code: Select all
bool toggle;
main {
if(is_active(BUTTON_16)) {
if(event_active(BUTTON_16))
if(time_release(BUTTON_16) < 200)
++toggle;
if(toggle) set_val(BUTTON_16, ((system_time()%80) < 40));
}
else toggle = 0;
}
-
DontAtMe - Captain
- Posts: 502
- Joined: Tue Oct 02, 2018 4:49 am
Re: stuck on a condition
thanks guys!
-
alencroat - Lieutenant
- Posts: 320
- Joined: Sun Oct 15, 2017 5:58 pm
6 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 137 guests