Need help understanding script creating/editing
13 posts
• Page 2 of 2 • 1, 2
Re: Need help understanding script creating/editing
Hey guys having a problem...trying to get my macro to run endlessly.
How do I make it so that if "button 9" is pressed once it will initiate the macro forever? So I don't have to keep hitting or holding the button.
I just used the example from the resources.
main {
// While BUTTON_2 is held-down ...
if(get_val(BUTTON_9)) {
// ... keep the macro "Example" running in an endless loop.
macro_run("wolf.gmk");
}
}
How do I make it so that if "button 9" is pressed once it will initiate the macro forever? So I don't have to keep hitting or holding the button.
I just used the example from the resources.
main {
// While BUTTON_2 is held-down ...
if(get_val(BUTTON_9)) {
// ... keep the macro "Example" running in an endless loop.
macro_run("wolf.gmk");
}
}
-
Mattyl22l - Sergeant
- Posts: 9
- Joined: Fri Jul 19, 2019 11:08 am
- Location: USA
Re: Need help understanding script creating/editing
Use a variable to set it to play or stop on button press.
This should do:
This should do:
- Code: Select all
bool play=FALSE;
main {
// The very moment the button gets pressed
if (event_active(BUTTON_9)) {
play=!play; // inverse the current state
if (!play) macro_stop(); // remove the // at the start of the line stop the playback instantly when play gets disabled
}
// ... keep the macro "Example" running in an endless loop.
if (play) macro_run("wolf.gmk");
}
-
Scachi - Brigadier General
- Posts: 3044
- Joined: Wed May 11, 2016 6:25 am
- Location: Germany
Re: Need help understanding script creating/editing
Worked like a charm! Thank you!
-
Mattyl22l - Sergeant
- Posts: 9
- Joined: Fri Jul 19, 2019 11:08 am
- Location: USA
13 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 205 guests